&& (logical AND)

本参考资料用于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.

名称

&& (logical AND)

示例

for (int i = 5;

i <= 95;

i += 5)
{  
if ((i > 35) && (i < 60))
{
stroke(0);

// Set color to black  
  } else{
stroke(255);

// Set color to white  
  }   line(30, i, 80, i);


  } 
描述 Compares two expressions and returns true only if both evaluate to true. 返回值 false if one or both evaluate to false. The following list shows all possible combinations:

true &

&

false // Evaluates false because the second is false
false &

&

true // Evaluates false because the first is false
true &

&

true // Evaluates true because both are true
false &

&

false // Evaluates false because both are false

语法
 expression1 && expression2 
参数
expression1 any valid expression
expression2 any valid expression
相关 || (logical OR)
! (logical NOT)
if

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

&& (logical AND)