while

本参考资料用于Processing 3.0+。 如果你使用的是前一版本,请在使用软件帮助菜单内的参考资料。. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

名称

while

示例

int i = 0;

while (i < 80)
{  
line(30, i, 80, i);


i = i + 5;


  }  
描述 Controls a sequence of repetitions. The while structure executes a series of statements continuously while the expression is true. The expression must be updated during the repetitions or the program will never "break out" of while.

This function can be dangerous because the code inside the while loop will not finish until the expression inside while becomes false. It will lock out all other code from running (e.g., mouse and keyboard events will not be updated). Be careful —

if used incorrectly, this can lock up your code (and sometimes even the Processing environment itself).

语法
 while (expression)
{  
statements
  } 
参数
expression a valid expression
statements one or more statements
相关 for

Updated on October 2, 2018 05:02:17pm EDT

while