Calq commands and keywords

Keyword

elseif

Definition

This keyword is used within an if statement to indicate the end of the body of commands to execute when the condition is met, and the beginning of a new (optional) condition statement. It is very similar to a nested if-statement, but else-if extends the current if statement, and thus does not need another end statement.

Example

  if (sqrt(3) > 2)
    disp('Square root of 3 is greater than 2.');
  elseif (sqrt(3) == 2)
    disp('Square root of 3 is equal to 2.');
  else
    disp('Square root of 3 is less than 2.');
  end

See also

else, end, and if


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