While/ja

From Second Life Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

while( conditionloop

•  condition これが実行されてtrueであれば loop が実行されます。
•  loop シングルステートメントでもブロックステートメントでも空のステートメントのいずれも可能です。


いずれのステートメントが空でも可能です。

詳細

条件の種類
条件
integer 0ではない場合は真。
float 0ではない場合は真。
string 文字列の長さが0ではない場合は真。
key keyが有効でNULL_KEYではない場合のみ真。
vector vectorがZERO_VECTORではない場合は真。
rotation rotationがZERO_ROTATIONではない場合は真。
list listの長さが0ではない場合は真。正しい動作は、Monoでコンパイルされたスクリプトのみで見られ、LSOでコンパイルされたスクリプトは誤って false になります。BUG-230728


//シングルステートメント
integer a = 0;
integer b = 10;
while(a < b)
    llOwnerSay((string)(a++));
//ブロックステートメント
integer a = 0;
integer b = 10;
while(a < b)
{
    llOwnerSay((string)a);
    ++a;
}
//空のステートメント
integer a = 0;
integer b = 10;
while(a++ < b);

ノート

do-while のループは while ループや for ループより LSO においては速いです。