esa / opengeode

OpenGEODE - a free SDL editor
https://opengeode.net
GNU Lesser General Public License v3.0
69 stars 20 forks source link

I meet another problem in Task!!! #53

Closed zongz1024 closed 5 years ago

zongz1024 commented 5 years ago

Sorry to bother you again. image And, I also want to ask how to express "switch", "do-while" and "while" in the TASK in OpenGEODE.

maxime-esa commented 5 years ago

What you show in the screenshot can be done in SDL with a DECISION symbol:

image

Or using a ternary operator in a TASK symbol:

someint := if someint > 0 then someint + 1 else someint - 1 fi

The DECISION is also used for switch-case:

image

And for ranges:

image

Loops can be done either using decisions and label/join:

image

Or using the "for" construct in a TASK symbol (warning: this is an extension to SDL, it will not work in other tools). The syntax is close to Python loops, and there are two variants:

for each in range (10) :     // range operator has the same syntax as the one in Python
    call writeln(each);
endfor

and:

for each in someArray : 
    // list of statements
endfor
zongz1024 commented 5 years ago

Sorry to bother you again. image And, I also want to ask how to express "switch", "do-while" and "while" in the TASK in OpenGEODE.

Really thanks! A great help for me!