case | ||||||||||
Type | keyword | |||||||||
Dictionary | LCS | |||||||||
Library | LiveCode Script | |||||||||
Syntax |
| |||||||||
Summary | Used within a switch control structure to designate one of the possibilities to be handled. | |||||||||
Introduced | 1.0 | |||||||||
OS | mac, windows, linux, ios, android | |||||||||
Platforms | desktop, server, mobile | |||||||||
Parameters |
| |||||||||
Example |
| |||||||||
Related | Keyword: word, character Function: value Glossary: keyword, current card, statement, execute, control structure, expression Control Structure: switch, break | |||||||||
Description | Use the case keyword to indicate the condition for which a set of statements should be executed. The case keyword can be used in two forms. The first form is used when the switch statement includes an expression : the case is executed if the value after the word case is equal to the expression in the switch control structure. For example, if the switch structure starts with this statement :
then a case statement inside the switch structure might look like this:
and the lines following the case keyword are executed if thisVariable = 3. Use this form if you want to test a single value, and do different things depending on what that value is equal to. The second form is used when the switch statement does not include an expression : the case is executed if the condition after the word case is true. For example, if the switch structure starts with this statement :
then a case statement inside the switch structure might look like this:
and the statements following the case keyword are executed if the character "a" appears in the current card's name. |