Switch: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:


   switch <gamevar>
   switch <gamevar>
     case: <constant>
     case <constant>
       <do something>
       <do something>
       [[break]]
       [[break]]
     case: <constant>
     case <constant>
       <do something>
       <do something>
       break
       break
   [[endswitch]]
   [[endswitch]]
Caution:  ''Nested switches do not work because of the way the CON compiler compiles them''.


[[Category:EDuke commands]]
[[Category:EDuke commands]]

Revision as of 22:27, 4 August 2006

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

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

Caution: Nested switches do not work because of the way the CON compiler compiles them.