Differences

This shows you the differences between two versions of the page.

prim:if [2009/09/09 09:39]
199.4.155.10
prim:if [2009/09/09 09:40] (current)
199.4.155.10 formatted code
Line 14: Line 14:
**IF** is used to selectively execute commands depending on the outcome of a "test". The test is a boolean expression--an expression that evaluates to either true or false. *IFELSE* is used to selectively execute some commands if the test is true, or a different set of commands if the test is false. **IF** is used to selectively execute commands depending on the outcome of a "test". The test is a boolean expression--an expression that evaluates to either true or false. *IFELSE* is used to selectively execute some commands if the test is true, or a different set of commands if the test is false.
-Example:+===== Example: =====
 +<code>
;; if the current patch is red, move forward 1 unit and turn left and jump again ;; if the current patch is red, move forward 1 unit and turn left and jump again
if pcolor = red [ jump 1 lt 90 jump 1] if pcolor = red [ jump 1 lt 90 jump 1]
Line 28: Line 29:
  jump -1   jump -1
] ]
 +</code>
===== Details ===== ===== Details =====
 
prim/if.txt · Last modified: 2009/09/09 09:40 by 199.4.155.10
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki