Switch

From EDukeWiki
Revision as of 00:16, 12 September 2021 by Doom64hunter (talk | contribs) (Remove misleading information)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The switch statement in CON is similar to that in C.

 switch <gamevar>
   case <constant>
     <do something>
   break
   case <constant>
     <do something>
   break
   default
     <do something>
   break
 endswitch

The case keyword works like an ifvare statement, and default operates on every possibility that is not specified by a case statement. Each case block must be terminated with a break statement.

See: Control Structures @ C++ Documentation