conditional_execution
The heart of any programing language is its ablilty to make descisions. So far you have your data and you can do something with it, but its not quite smart enough to make its own descisions. By making your data meet certain criteria you can control how it flows and what happens. IF THEN ELSE - Probably the most fundamental of the conditial statements. Its much like talking to someone in real life. IF beer is under 5 dollars THEN buy, ELSE buy water. ELSE being an option since you might not want anything at all. syntax: IF (conditional expression) THEN {commands} ELSE {commands} WHILE DO - This is a looping condition. WHILE this criteria is met DO this. For example, WHILE not tierd DO run. syntax: WHILE (conditional expression) DO {commands} FOR TO/DOWNTO DO - The FOR statement is used to loop through a block of statements a fixed number of times. The TO and DOWNTO keywords are used for the same purpose, except TO will increment the <ident> by 1 and DOWNTO will decrement by 1 during each iteration of the loop. syntax: FOR (variable) = (start variable TO or DOWNTO) DO {commands} REPEAT UNTIL - The REPEAT condition is used to loop a block of commands UNTIL specified criteria is not false. This statement differs from the WHILE statement because the command block will be performed at leave once, until the first time the condition-expression is evaluated. In the WHILE statement, the command block might not be executed even once. syntax: REPEAT {commands} UNTIL (conditional expression) ADD OR - These work in conjunction with the other conditional expressions. IF beer < $5.00 AND wallet > $8.00 THEN buy. syntax: IF (conditional expression) AND/OR (conditional expression) THEN {commands} or UNTIL (conditional expression) AND/OR (conditional expression) note: when using AND/OR "(",")" must be used to siginify seperate conditional expressions. IF (this=5) AND (that>4) THEN {exit}
conditional_execution.txt · Last modified: by admin