Scilab 6.0.0
Scilabヘルプ >> Scilab > Control flow > while
while
while キーワード
説明
while
構文.
"end"
で終わる必要があります.
while expr ,instructions,...[,else instructions], end
while expr do instructions,...[,else instructions], end
while expr then instructions,...[,else instructions], end
注意:
唯一の制約は,
then
またはdo
キーワードをwhile
キーワードと同じ行に置く必要がある ことです.キーワード
then
またはdo
は キャレッジリターンまたはカンマで置換することができます. Matlabとの互換性のため,推奨されませんが, 式の終わりと命令の始まりの間に空白を置く方法で代替することも可能です.オプションの
,else instructions
構造により, 式の評価が偽となった場合に実行される命令を指定することが可能です.
Scilabプログラミング言語のコード規約に基づき, 以下が推奨されます:
各命令を新しい行で開始する.
1行に複数の命令を記述しない.
複合命令は,複数行に分割する.
例えば以下のようにします:
i = 0 while i<5 disp("i"); i = i + 1; end
以下は推奨されません.
i = 0; while i<5 disp("i"); i = i + 1; end
![]() | 警告: 条件付き命令(if while for または select/case)の本文を定義するために使用可能な
文字数は 16 k以下とする必要があります. |
例
e=1; a=1; k=1; while norm(a-(a+e),1) > %eps, e=e/2; k=k+1; end e,k
Comments
Add a comment:
Please login to comment this page.