Thursday, 25 July 2019

Processing: Conditional operators


Conditional operators determine if one operand is greater than, less than, equal to, or not equal to another operand.

Operator
Description
==
equal to
!=
not equal to
> 
greater than
>=
greater than or equal to
< 
less than
<=
less than or equal to

Conditional operators takes two operands and return true, if the condition evaluates to true, otherwise return false.

Operators.pde
int a = 10, b=11;

println("is a equals to a " + (a==a));
println("is a equals to b " + (a==b)); 
println("is a not equals to a " + (a!=a));
println("is a not equals to b " + (a!=b));
println("is a less than a " + (a<a));
println("is a less than b " + (a<b));
println("is a less than or equal to a " + (a<=a));
println("is a less than or equal b " + (a<=b));
println("is a greater than a " + (a>a));
println("is a greater than b " + (a>b));
println("is a greater than or equal to a " + (a>=a));
println("is a greater than or equal to b " + (a>=b));


Output
is a equals to a true
is a equals to b false
is a not equals to a false
is a not equals to b true
is a less than a false
is a less than b true
is a less than or equal to a true
is a less than or equal b true
is a greater than a false
is a greater than b false
is a greater than or equal to a true
is a greater than or equal to b false





Previous                                                    Next                                                    Home

No comments:

Post a Comment