---
# System prepended metadata

title: Scratch

---

# Scratch

([home](https://github.com/alexhkurz/introduction-to-programming/blob/master/README.md) ... [previous](https://hackmd.io/@alexhkurz/ry2Ax1FC8) ... [next](https://hackmd.io/@alexhkurz/Sks4Jxekw))

[Scratch](https://scratch.mit.edu/projects/408463938/editor) is an interesting programming language for teaching a first introduction to programming. The junior version has been designed for children as young as 5, but it also has many features such as real-time, parallelism and message passing that one often encounters only at a more advanced level.

In fact, Scratch is a serious programming language put inside an IDE that can be understood intuitively and easily explored by trial and error. Moreover, Scratch provides a wide range of effects that allows one to have fun with animation and sounds and story telling. There are also extensions for writing music, video sensing, text to speech, translation and much more.

The reason to make a short excursion to Scratch here is to pause a little and check whether we can transfer what we have learned to a new setting. 

Look at some of our [sequences in Scratch](https://scratch.mit.edu/projects/408985269).

- The green flag initialises the program. Use "space" to start or continue and "s" to stop and "r" to reset.
- A program is built from blocks. The pink blocks are those we define ourselves. I used them to make the code more readable.
- Scratch has events such as "when clicked" or "when key pressed". 
- It is possible to use the same event to start different parts of the program to run in parallel.
- Scratch has real time such as in "wait 10 secs".
- I didn't use any effects such as motion or sounds, but this is something Scratch is good at. It is also possible to synchronise different programs via message passing.

**Activity:** Write some Scratch programs. Some suggestions:
- Add some new sequences. For concrete examples, go back to the session on [loops](https://hackmd.io/@alexhkurz/H1o4Mcr6L) or take the Fibonacci program from the [previous session](https://hackmd.io/@alexhkurz/ry2Ax1FC8).
- Add sounds. 
- Change the background.
- You can also program the background to change.
- Add animations.
- ... 

You find many tutorials in Scratch ... look for the link in the [IDE](https://hackmd.io/@alexhkurz/H1o4Mcr6L). For special topics [the wiki](https://en.scratch-wiki.info/wiki/) is an excellent reference. Look eg at [jumping](https://en.scratch-wiki.info/wiki/Jumping). 


