MAXScript には continue
構造が提供されています。この構造により for
、do
、while
ループ本体 <expr>
の末尾にジャンプして、次のループ反復を再開することができます。
構文を次に示します。
Continue
例:
for i=1 to 8 do (if i == 5 do continue; print i) -- prints 1..4, 6..8
while not eof f do -- read until reach end of file ( local line=readline f -- read in a line if line[1] = = "-" do continue -- if comment, skip to next line line1=parser1 line -- call function parser1 processobjs line1 -- call function processobjs )
continue
が for ... collect
ループ内で実行されると、そのループ反復の式の結果は本体値の配列で収集されません。
例:
for i=1 to 8 collect (if i = = 5 do continue; i) -- returns #(1, 2, 3, 4, 6, 7, 8)