-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |