diff --git a/site/content/exercises/makecode/robotics/E7/Lesson35.png b/site/content/exercises/makecode/robotics/E7/Lesson35.png new file mode 100644 index 00000000..28be719e Binary files /dev/null and b/site/content/exercises/makecode/robotics/E7/Lesson35.png differ diff --git a/site/content/exercises/makecode/robotics/E7/Lesson38.png b/site/content/exercises/makecode/robotics/E7/Lesson38.png new file mode 100644 index 00000000..6b674e5e Binary files /dev/null and b/site/content/exercises/makecode/robotics/E7/Lesson38.png differ diff --git a/site/content/exercises/makecode/robotics/E7/index.md b/site/content/exercises/makecode/robotics/E7/index.md new file mode 100644 index 00000000..2a7efbc8 --- /dev/null +++ b/site/content/exercises/makecode/robotics/E7/index.md @@ -0,0 +1,32 @@ +--- +template: exercise +title: Functions +level: 3 +exercise: 7 +category: Robotics +tags: ['MakeCode', 'Functions', 'CPX'] +description: Creating functions to perform calculations and group commands +--- + +- **What are functions?** + - Functions are fundamental building blocks of programs\. + - They let you name a set of commands\. + - Once defined\, a function can be re\-used over and over\. +- **Examples of functions:** + - Add\( *x\, y* \) + - Take two numbers *x* and *y* \, and return the sum *x\+y* + - \(takes input and returns output\) + - TurnOn\( *x* \) + - Take a number between 0 and 9\, and turn on that LED + - \(takes input\, does not return output\) + - PartyTime\(\) + - Set all pixels to red\, play a tune + - \(doesn’t take input\, doesn’t return output\) + +## Creating Functions + +![](Lesson35.png) + +## Defining and Calling Functions + +![](Lesson38.png)