2017-10-10 14:55:21 +00:00
|
|
|
#REDIRECT [[SELECT CASE#allCASES]]
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2017-10-10 14:55:21 +00:00
|
|
|
[[CASE ELSE]] is used in a [[SELECT CASE]] procedure as an alternative if no other [[CASE]] statements are true.
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
|
2017-10-10 14:55:21 +00:00
|
|
|
{{PageDescription}}
|
|
|
|
* [[CASE ELSE]] should be listed at the bottom of the case list as it will supersede any case statements after it.
|
2019-04-15 01:15:33 +00:00
|
|
|
* Use it as a "safety net" or as an alternative for all values not covered in the [[CASE]] statements.
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
{{PageExamples}}
|
|
|
|
''Example 1:''
|
|
|
|
{{CodeStart}}
|
|
|
|
|
|
|
|
a = 100
|
|
|
|
{{Cl|SELECT CASE}} a
|
2019-04-15 01:15:33 +00:00
|
|
|
{{Cl|CASE}} {{Cl|IS}} < 99: {{Cl|PRINT}} "a is < 99"
|
|
|
|
{{Cl|CASE}} 99: {{Cl|PRINT}} "a is 99"
|
|
|
|
{{Cl|CASE}} {{Cl|IS}} > 100: {{Cl|PRINT}} "a is > 100"
|
2015-08-02 12:12:44 +00:00
|
|
|
{{Cl|CASE ELSE}}
|
2019-04-15 01:15:33 +00:00
|
|
|
{{Cl|PRINT}} "a is 100"
|
2015-08-02 12:12:44 +00:00
|
|
|
{{Cl|END SELECT}}
|
|
|
|
|
|
|
|
{{CodeEnd}}
|
|
|
|
|
|
|
|
{{OutputStart}}
|
|
|
|
|
|
|
|
a is 100
|
|
|
|
|
|
|
|
{{OutputEnd}}
|
|
|
|
|
2017-10-10 14:55:21 +00:00
|
|
|
|
2015-08-02 12:12:44 +00:00
|
|
|
''Example 2:''
|
|
|
|
{{CodeStart}}
|
|
|
|
|
|
|
|
a = 100
|
|
|
|
{{Cl|SELECT CASE}} a
|
2019-04-15 01:15:33 +00:00
|
|
|
{{Cl|CASE}} 10: {{Cl|PRINT}} "a is 10"
|
|
|
|
{{Cl|CASE}} 20: {{Cl|PRINT}} "a is 20"
|
|
|
|
{{Cl|CASE}} 30: {{Cl|PRINT}} "a is 30"
|
|
|
|
{{Cl|CASE ELSE}}: {{Cl|PRINT}} "a is something other than 10, 20 and 30"
|
2015-08-02 12:12:44 +00:00
|
|
|
{{Cl|END SELECT}}
|
|
|
|
|
|
|
|
{{CodeEnd}}
|
|
|
|
{{OutputStart}}
|
|
|
|
|
|
|
|
a is something other than 10, 20 and 30
|
|
|
|
|
|
|
|
|
|
|
|
{{OutputEnd}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{{PageSeeAlso}}
|
2017-10-10 14:55:21 +00:00
|
|
|
*[[SELECT CASE]]
|
|
|
|
*[[IF...THEN]], [[ELSE]]
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
|
2019-04-15 01:15:33 +00:00
|
|
|
{{PageNavigation}}
|