?: (conditional)ControlConditionalsWeb & Application
int s = 0;
for(int i=5; i<100; i+=5) {
s = (i < 50) ? 0 : 255;
stroke(s);
line(30, i, 80, i);
}
A shortcut for writing an if() and else structure. If the condition evaluates to true, expression1 is evaluated and returned. If the condition evaluates to false, expression2 is evaluated and returned.
condition ? expression1 : expression2any valid expression which evaluates to true or falseany valid expressionany valid expressionVariable, dependent on the datatype of the expressions
if()
else
1.0StructurePDEExtended