FUNCTION REFERENCE

elseif

Test another condition when the if condition is false.

Test another condition when the if condition is false.

Syntax

if c1, ..., elseif c2, ..., end

Syntax

if c1, ..., elseif c2, ..., else, ..., end

Used inside if. The first true condition runs its block and the rest are skipped. Write elseif as one word.

Example

x = 3; if x < 2, disp('a'), elseif x < 4, disp('b'), else, disp('c'), end   % prints: b

Differences from MATLAB: Not checked against MATLAB yet.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.