Calq commands and keywords

Keyword

otherwise

Definition

This keyword is used inside a switch block. It specifies what to do if none of the cases match. We compare the expression following the switch keyword, and try to match it to one of the "case" values. If none of them match, we will select the "otherwise" block, if it exists. There should be at least one "case" within a switch block, and there can be many of them. The "otherwise" part may not be specified. If so, there is only one "otherwise" per switch command.

Example

  a = 2;
  switch (a)
    case 1
      disp('one');
    case 2
      disp('two');
    otherwise
      disp('not one or two');
  end

  two

See also

case. if. otherwise.


What is Calq?
Latest version of Calq
Digital Wave Systems Lab homepage