Skip to content

Commit

Permalink
Add Functions MakeCode Lesson
Browse files Browse the repository at this point in the history
  • Loading branch information
wheeler-c committed Mar 20, 2024
1 parent c61d800 commit eb67a9e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
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.
32 changes: 32 additions & 0 deletions site/content/exercises/makecode/robotics/E7/index.md
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)

0 comments on commit eb67a9e

Please sign in to comment.