drag to orbit ยท scroll to zoom
โ† Playground

๐Ÿ”€ Rail Switch ยท if / else

A box rolls down to the switch. A signal light checks the condition โ€” green sends it down the if track, red sends it down the else track.

Value n
7
n > 5 โ†’ True
Drag n to change the condition, then send the box down the rail.
Python code
if n > 5: main_track() # True else: side_track() # False

๐Ÿ’ก An if/else is a fork in the road. Only one path is taken โ€” never both.