| www.delorie.com/gnu/docs/octave/octave_80.html | search |
![]() Buy GNU books! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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
octave-maintainers@bevo.che.wisc.edu. (But if you think you've
found a bug, please report it to bug-octave@bevo.che.wisc.edu.
The general form of the switch statement is
switch expression
case label
command_list
case label
command_list
...
otherwise
command_list
endswitch
|
switch, case, otherwise, and
endswitch are now keywords.
case label command_list
clause.
otherwise command_list clause is optional.
end keywords, endswitch may be
replaced by end, but you can get better diagnostics if you use
the specific forms.
switch (foo) case (1) -2 ... |
would produce surprising results, as would
switch (foo)
case (1)
case (2)
doit ();
...
|
particularly for C programmers.
if block, even if all
the labels are integer constants. Perhaps a future variation on this
could detect all constant integer labels and improve performance by
using a jump table.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |