while (condition) { statement1; statement2; ... }
while 语句将检查条件。如果条件为 true,则执行块,然后重复。只要条件为 true,块将继续执行。
float $test = 0; while ($test < 5) { print("$test equals: " +$test+"\n"); $test = $test + 1; }
该示例将在“脚本编辑器”(Script Editor)中打印以下行:
$test equals: 0 $test equals: 1 $test equals: 2 $test equals: 3 $test equals: 4