Used within a switch control structure to designate one of the possibilities to be handled.
# Metadata
Platforms: desktop, server, mobile OS: mac, windows, linux, ios, android Introduced: 1.0 Security:
# Syntax
case value
# Params
# Examples
case "A"
case myChar = "A"
# Description
The case keyword can be used in two forms. The first form is used when the switch statement includes an expression : the case is execute if the value after the word case is equal to the expression in the switch control structure. For example, if the switch control structure starts with this statement :
switch thisVariable
then a case statement inside the switch control structure might look like this:
case 3
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 execute if the condition after the word case is true. For example, if the switch control structure starts with this statement :
switch
then a case statement inside the switch control structure might look like this:
case the short name of this card contains "a"
and the statements following the case keyword are execute if the character "a" appears in the current card name.
# Tags
# See
- **keyword:** word, character - **function:** value - **glossary:** keyword, current card, statement, execute, control structure, expression - **control structure:** switch, break