Lesson 4 · Parameters & Customization — Knowledge ChecksAnswer key
You click the gear on a function block and drag an 'input name' block into the 'inputs' block. What happens to the function definition?
The definition block changes shape as soon as the input connects — that 'with:' row is the parameter list. Renaming the input renames what appears there.
Inside the function body, where do you get a block that holds the parameter's value?
Adding a parameter creates a variable of the same name, and Blockly lists it under Variables. Drag that block into any slot inside the function where you want the value.
In the call square (side_length: 50), what is the 50?
The parameter is the name (side_length) in the definition; the argument is the value (50) you pass when calling.
With square (side_length), calling square (side_length: 35) makes the robot drive each side how long?
The argument 35 flows into the side_length parameter, so every Straight drives 35 cm.
A function is defined as draw rectangle (length, width). Are draw rectangle (50, 30) and draw rectangle (30, 50) the same?
Arguments fill parameters in order. (50, 30) means length 50 / width 30; (30, 50) swaps them into a different rectangle.