Lesson 3 of 8
A named group that takes a number
Show on a big screenChalk rows can be different lengths. Do you need a new block for each row?
In the steps below, n stands for the number of dots.
Step 1 of 4
- One definition: draw a row of n dots.
- Call it with 5: five dots.
- Call it with 6: six dots.
- Call it with 4: four dots.
No. One named block can draw rows of different lengths.
The rule
A named block can take a number. The same lines run each time, on the number you hand in.
A parameter is a box on the block. The number you hand in goes into the box. To hand in a number means to give it to the block.
| Call | Number handed in | Dots drawn |
|---|---|---|
| 1 | 5 | 5 |
| 2 | 6 | 6 |
| 3 | 4 | 4 |
Three calls draw 5 + 6 + 4 = 15 dots in all. There is still only one definition.
Hand in a number. Call the block.
Loading lab…
Try the lab to finish this lesson.