This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. 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 OR)

example pic
for (int i = 5 ; i <= 95; i += 5) {
  if ((i < 35) || (i > 60)) {
    line(30, i, 80, i);
Description Compares two expressions and returns true if one or both evaluate to true. Returns false only if both expressions are false. The following list shows all possible combinations:

true || false // Evaluates true because the first is true
false || true // Evaluates true because the second is true
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
Related&& (logical AND)
! (logical NOT)
Updated on January 1, 2021 03:38:12am EST