Make a variable
The blocks in Scratch are sorted into coloured categories. Events blocks are yellow, Motion blocks are blue, Looks blocks are purple, Sensing blocks are light blue, Operators blocks are green and Variables blocks are orange. To make a variable, open the Variables category and click Make a Variable. Type a clear name. Then choose For all sprites, so that every sprite can use it, or For this sprite only. The new variable then appears with its own blocks. Use set to give it a value and change by to add to it. The block ask and wait is in Sensing, and it stores the reply in the block answer. The block join, in Operators, sticks pieces of text together.
| Block | Category | What it does |
|---|---|---|
| ask [ ] and wait | Sensing | asks a question and waits for a reply |
| (answer) | Sensing | holds the last reply that was typed |
| (join [ ] [ ]) | Operators | sticks two pieces of text together |
| set [ ] to ( ) | Variables | puts a value in a variable |
| change [ ] by ( ) | Variables | adds a number to a variable |
| say [ ] for ( ) seconds | Looks | shows a speech bubble |
| Step | What to do |
|---|---|
| 1 | Click the Variables category. |
| 2 | Click the button Make a Variable. |
| 3 | Type the name tickets. |
| 4 | Choose For all sprites or For this sprite only. |
| 5 | Click OK. The new blocks and a monitor appear. |
Paper blocks (no computer): cut out strips of coloured paper and write one block on each: when this sprite clicked, ask [What is your name?] and wait, set [name v] to (answer), say (join [Hello ] (name)) for (2) seconds. Colour them by category with pencils: yellow for Events, light blue for Sensing, orange for Variables and purple for Looks. Mix them up, and put them in the right order. Then act it out: an adult is the user and answers the question, and you say the greeting. If you have a computer or tablet, open Scratch and find each block.