ifelse
condition [list of commands1] [list of commands2]
Parameters:
| condition |
Boolean |
Condition that evalutes to either true or false |
| [list of commands1] |
List of commands |
Runs if $arg1 is true |
| [list of commands2] |
List of commands |
Runs of $arg2 is false |
Description:
Do [list of commands1] if condition reports true, otherwise do [list of commands2].
Examples:
ifelse color = black [fd 2] [bk 2] would make black turtles move forward 2 steps and all other turtles move back 2 steps.
Related Commands:
if