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 8d07f17
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 8d07f17

Please sign in to comment.