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

Change language to:
English - Français - Português

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab manual >> Scilab > Scilab keywords > for

for

ループ用の言語キーワード

説明

ループ定義に使用されます.その構文は以下のようになります: for variable=expression ,instruction, .. ,instruction,end

for variable=expression do instruction, ,instruction,end

expression が行列または行ベクトルの場合, variable の値は行列の各列の値となります.

具体例として,一定間隔の行ベクトルを作成するために コロン演算子を使用し, 典型的な for ループを作成します : for variable=n1:step:n2, ...,end

expression が リストの場合, variableはこのリストの連続するエントリを 値とします.

警告: 条件文(if while for または select/case)の本体を定義するために 使用できる文字の数は,16k に制限されています.

// "traditional" for loops
n=5;
for i = 1:n, for j = 1:n, a(i,j) = 1/(i+j-1);end;end
for j = 2:n-1, a(j,j) = j; end; a
for j= 4:-1:1, disp(j),end // decreasing loop

//loop on matrix columns
for  e=eye(3,3),e,end  
for v=a, write(6,v),end        
for j=1:n,v=a(:,j), write(6,v),end 

//loop on list entries
for l=list(1,2,'example'); l,end

参照

<< equal Scilab keywords global >>

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:
Wed Jan 26 16:25:00 CET 2011