Please note that the recommended version of Scilab is 5.5.1. This page might be outdated.
See the recommended documentation of this function
if then else
if expr1 then statements elseif expri then statements .... else statements end
if statement evaluates a logical expression and executes a group
of statements when the expression is true.
expri are expressions with numeric or boolean
expri are matrix valued the condition is true only if
all matrix entries are true or different from zero.
else provide for the
execution of alternate groups of statements. An
which matches the
if, terminates the last group of
statements. The line structure given above is not significant, the
only constraint is that each
then keyword must be on the same
line as its corresponding
then can be replaced by a carriage return or a
Warning: the number of characters used to define the body of any conditionnal instruction (if while for or select/case) must be limited to 16k.
i=2 for j = 1:3, if i == j then a(i,j) = 2; elseif abs(i-j) == 1 then a(i,j) = -1; else a(i,j) = 0; end, end
Add a comment:
Please login to comment this page.
|<< hat||Scilab keywords||left >>|