switch

Top  Previous  Next

Scripts > Class elements and c++ instructions > Interpreted C++ instructions > Control structures > switch

 

Syntax

 

switch ( <switch variable> ) {

 

case <constant expression> : <statement>; [break;]

   .

   .

   .

default : <statement>;

 

}

 

Description

 

Use the switch statement to pass control to a case, which matches the <switch variable>. At which point the statements following the matching case evaluate.

If no case satisfies the condition the default case evaluates.

To avoid evaluating any other cases and relinquish control from the switch, terminate each case with break;.



This page belongs to the TextTransformer Documentation

Home  Content  German