{ }codelper

Learn with tiles › 19

Making a variable

Make a variable, a box that holds a value.

1

A variable is a box that holds a value. Every box has a name.

The green tile "set step to 30", placed on its own at the top, makes the variable step and puts 30 in it. It is outside any event tile, so it runs once, right at the start.

In the move tile below, the x slot holds step instead of a number. Lara walks by the number in the box.

Change the number in the box to 60.

To do Put 60 in the variable step, so that Lara moves by 60 each time you tap her.

Loading tiles…

2

A variable can hold text as well as numbers.

To put a variable in a slot, tap the slot and then tap ▾. The variables you have made are in the Variables group.

Put the variable greeting in the slot of the say tile.

To do Make Lara say the text in the variable greeting.

Loading tiles…

Next: Raising the score →