💾 Archived View for gem.sdf.org › s.kaplan › cheatsheets › programming-languages › scratch.md captured on 2024-08-18 at 18:18:49.

View Raw

More Information

⬅️ Previous capture (2023-09-28)

-=-=-=-=-=-=-

# Scratch Cheatsheet

## Unique Features
- Visual programming language
- Drag-and-drop interface
- Designed for teaching programming concepts to children
- Event-driven programming

## Variables
- Create variable: `set [variable name] to [value]`
- Change variable: `change [variable name] by [value]`
- Show variable: `show variable [variable name]`
- Hide variable: `hide variable [variable name]`

## Functions
- Define function: `define [function name]`
- Call function: `call [function name]`

## Loops
- Forever loop: `forever`
- Repeat loop: `repeat [number] times`
- While loop: `repeat until <[condition]>`
- For loop: `for [variable] from [start] to [end]`
- For each loop: `for each [variable] in [list]`

## Conditionals
- If statement: `if <[condition]> then`
- If-else statement: `if <[condition]> then else`
- If-else if statement: `if <[condition]> then else if <[condition]> then`

## Event Handling
- Event definition: `when [event]`
- Broadcast event: `broadcast [event]`
- Receive event: `when I receive [event]`

## Motion
- Move: `move [value] steps`
- Turn: `turn [value] degrees`
- Go to: `go to x: [value] y: [value]`
- Glide: `glide [value] secs to x: [value] y: [value]`

## Looks
- Show: `show`
- Hide: `hide`
- Switch costume: `switch costume to [costume]`
- Next costume: `next costume`
- Change size: `change size by [value]`
- Set size: `set size to [value]%`

## Sound
- Play sound: `play sound [sound]`
- Stop sound: `stop all sounds`
- Change volume: `change volume by [value]`
- Set volume: `set volume to [value]%`

## Resources
- [Scratch Project Ideas](https://scratch.mit.edu/ideas)
- [ScratchEd](https://www.scratch.mit.edu/educators)
- [Scratch Wiki](https://en.scratch-wiki.info)