Calq commands and keywords

Keyword

switch

Definition

This keyword specifies a switch block. This is similar to an "if" statement with several "elseif" parts. 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.

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