If

OpenMatrix language supports conditional execution of statements using the if/elseif/else construct.

if condition1
  block1
elseif condition2 
  block2
elseif conditionN
  blockN
else
  blockElse
end

Each condition is an expression. If the expression evaluates to a non-zero (for example, true) value, the code in that block is executed. The conditions are tested in order. At most, one block is executed for each set of if statements. The elseif and else statements are optional. The blockElse is run only if no other blocks were run.

Example 1

x= 4
     if x == 4
           disp('hello 4')
     end

Example 2

x= 5
if x == 4
      disp('hello 4')
elseif x == 5
      disp('hello 5')
end	

Example 3

x= 3
if x == 4
      disp('hello 4')
else
      disp('hello number')
end

Example 4

x= 3
if x == 4
      disp('hello 4')
elseif x == 5
      disp('hello 5')
else
      disp('hello number')
end