while
while keyword
Description
The while
clause must be terminated by
"end"
.
while expr ,instructions,..., end
while expr do instructions,..., end
while expr then instructions,..., end
Notes:
The only constraint is that each
then
ordo
keyword must be on the same line aswhile
keyword.Keywords
then
ordo
can be replaced by a carriage return or a comma. For compatibility with Matlab it is also possible, but not recommended, to put a space between the end of the expression and the beginning of the first instruction.
According to the Code Conventions for the Scilab Programming Language it is recommended:
Start each statement on a new line.
Write no more than one simple statement per line.
Break compound statements over multiple lines.
For example, use:
i = 0 while i<5 disp("i"); i = i + 1; end
rather than
i = 0; while i<5 disp("i"); i = i + 1; end
![]() | Warning: the number of characters used to define the body of any
conditional instruction (if while for or select/case) must be
limited to 16k. |
Examples
e=1; a=1; k=1; while norm(a-(a+e),1) > %eps, e=e/2; k=k+1; end e,k
See Also
History
Version | Description |
6.0.0 | The [,else instructions] construction no more supported. |
Comments
Add a comment:
Please login to comment this page.