{ }codelper

Learn with tiles › 15

Else

Do one thing when the condition is true and another thing when it is not.

1

The if (condition) then … else … tile has two slots. When the condition is true it does the upper slot. When it is not true it does the lower slot. It always does one of the two. (Tapping + else under an "if" tile makes the same tile.)

The lower slot (else) is empty. Put a say tile in it.

To do If the x position is greater than 100, say Far!. Else, say Near!.

Loading tiles…

2

Let's make Lara go back and forth between left and right each time you tap her.

If Lara is on the left (her x position is less than 0), send her to the right. Else, send her to the left.

To do If the x position is less than 0, move to x 150, y -60. Else, move to x -150, y -60.

Loading tiles…

Next: Touching? →