The if statement is a decision-making statement. In its simplest form, it looks like this:
if (x > 0) zz = 1/x; end
The expression ``x > 0'' controls what the rest of the statement will do. The command ``zz = 1/x'' is executed only if the condition ``x > 0'' is true.
The second form looks like this:
if (x > 0) zz = 1/x; else zz = -1; end
If the condition is true, ``zz = 1/x'' is executed; otherwise, ``zz = -1'' is executed.