What does this mean:
if (value > 10 || value == 20) {
Any answer would be nice. thanks!
What does this mean:
if (value > 10 || value == 20) {
Any answer would be nice. thanks!
It means OR. If one of these two options will be true, the if statement will be true.
Note:
both && = AND and || = OR have short evaluation. So if there if other conditions can't change status it won't continue.
http://www.cs.columbia.edu/~lennox/3101-03/class1-slides/logical.html
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op2.html :
The && and || operators perform Conditional-AND and Conditional-OR operations on two boolean expressions. These operators exhibit "short-circuiting" behavior, which means that the second operand is evaluated only if needed.
&& Conditional-AND || Conditional-OR
|| is a short circuit 'or' boolean operator
If the expression on the left hand side evaluates to true there is no need to evaluate the expression on the right as the condition has already been met
It is an OR conditional Statement. In your particular case, the statements inside the if block will be executed, if the value is more than 10 or if it is equal to 20. Hope this explains what you intended to ask.