User Tools

Site Tools


en:case

Differences

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

Link to this comparison view

en:case [2016/08/08 10:52]
admin
en:case [2020/02/28 10:46]
Line 1: Line 1:
-===== Begin Case / Case / End Case (Statement) ===== 
-==== Format ==== 
-**begin case**\\ 
-**case** //boolean_expr//\\ 
-//statement(s)//\\ 
-**case** //boolean_expr//\\ 
-//statement(s)//\\ 
-**else**\\ 
-//statement(s)//\\ 
-**end case** 
  
-==== Description ==== 
- 
-The **case** structure allows the programmer to create a structure to test multiple conditions.  Only the first true condition is executed and all of the other conditions are skipped.  If there is an optional **else**  as the last condition this will be executed if no other conditions are met. 
- 
-==== Example ==== 
-<code> 
-for t = 1 to 10 
-   begin case 
-      case t < 3 
-         print t + " is less than 3" 
-      case t < 7 
-         print t + " is less than 7 but 3 or larger" 
-      else 
-         print t +  " is 7 or larger" 
-   end case 
-next t 
-</code> 
- 
-displays: 
-<code> 
-1 is less than 3 
-2 is less than 3 
-3 is less than 7 but 3 or larger 
-4 is less than 7 but 3 or larger 
-5 is less than 7 but 3 or larger 
-6 is less than 7 but 3 or larger 
-7 is 7 or larger 
-8 is 7 or larger 
-9 is 7 or larger 
-10 is 7 or larger 
-</code> 
- 
-==== See Also ==== 
-{{page>en:start#Program Control&noheader}} 
- 
-==== History ====  
-|1.0.0.9|New To Version| 
en/case.txt · Last modified: 2020/02/28 10:46 (external edit)