As in all programming languages, Logo allows you to check if a condition is satisfied and then to execute the desired
code if it’s true or false.
With the primitive if you can realize those tests.
Important: When the result of the first predicate is equal to false, the primitive if looks for a second list, I mean an expression starting with a square bracket. In some very rare cases, it can’t be done, and you’ll have to use the primitive ifelse . For example:
# We affect two lists in variables a and b make "a [print true] make "b [print false] # First test with the primitive if--> The second list can’t be evaluated. if 1=2 :a :b What to do with [print false]? # Second test with the primitive ifelse --> success. ifelse 1=2 :a :b false |