Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2023.0.0 - 日本語


while

while キーワード

呼出し手順

while expr ,instructions,..., end
while expr do instructions,..., end
while expr then instructions,..., end

説明

while 構文. "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

参照

  • |, || — Binary OR between integers. Logical OR over/between booleans and numbers
  • &, && — Binary AND between integers. Logical AND over/between booleans and numbers
  • break — ループ中断を表すキーワード
  • for — ループ用の言語キーワード
  • select — select キーワード

履歴

バージョン記述
6.0.0
  • The [,else instructions] syntax is no longer supported.
  • while is now protected: Assignments like while=1 are no longer possible.
Report an issue
<< try Control flow Configuration >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Mar 07 09:28:37 CET 2023