Reference+
Name
|| (logical OR)
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
Examples
size(400, 400); for (int i = 20 ; i <= 380; i += 20) { if ((i < 140) || (i > 240)) { line(120, i, 320, i); } }
Syntax
expression1 || expression2
Parameters
expression1
any valid expressionexpression2
any valid expression
Related
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.