This shows you the differences between two versions of the page.
|
guide:ifelse [2008/03/31 23:55] 71.245.113.88 |
guide:ifelse [2009/07/17 14:31] (current) 67.149.64.123 Syntax was an error using [] instead of () for conditions |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| {{page>prim:if-else&firstsectiononly}} | {{page>prim:if-else&firstsectiononly}} | ||
| + | |||
| ===== Emulating SWITCH and SELECT CASE===== | ===== Emulating SWITCH and SELECT CASE===== | ||
| Line 13: | Line 14: | ||
| <code netlogo4> | <code netlogo4> | ||
| - | if-else [ test-1 ][ action-1 ][ | + | if-else ( test-1 )[ action-1 ][ |
| - | if-else [ test-2 ][ action-2 ][ | + | if-else ( test-2 )[ action-2 ][ |
| - | if-else [ test-3 ][ action-3 ][ | + | if-else ( test-3 )[ action-3 ][ |
| - | if-else [ test-4 ][ action-4 ][ | + | if-else ( test-4 )[ action-4 ][ |
| ]]]] | ]]]] | ||
| </code> | </code> | ||
| Line 26: | Line 27: | ||
| <code netlogo4> | <code netlogo4> | ||
| - | if-else [ test-1 ][ action-1 ][ | + | if-else ( test-1 )[ action-1 ][ |
| - | if-else [ test-2 ][ action-2 ][ | + | if-else ( test-2 )[ action-2 ][ |
| - | if-else [ test-3 ][ action-3 ][ | + | if-else ( test-3 )[ action-3 ][ |
| - | if-else [ test-4 ][ action-4 ][ | + | if-else ( test-4 )[ action-4 ][ |
| default-action | default-action | ||
| ]]]] | ]]]] | ||