Node:The switch Statement, Next:, Previous:The if Statement, Up:Statements



The switch Statement

The switch statement was introduced in Octave 2.0.5. It should be considered experimental, and details of the implementation may change slightly in future versions of Octave. If you have comments or would like to share your experiences in trying to use this new command in real programs, please send them to maintainers@octave.org. (But if you think you've found a bug, please report it to bug@octave.org.

The general form of the switch statement is

switch expression
  case label
    command_list
  case label
    command_list
  ...

  otherwise
    command_list
endswitch

warn_variable_switch_label Built-in Variable
If the value of this variable is nonzero, Octave will print a warning if a switch label is not a constant or constant expression