Combine statements within an if statement
It is possible to combine conditions that are inside of an if statement with the help of AND and OR statements.
AND statement is used to perform a Boolean expression that combines results of each condition, and only if all of the conditions are true then entire condition evaluates to TRUE.
OR condition just like AND condition is used to perform Boolean operations on the results of expressions. If any of the expressions evaluate to TRUE, then entire condition evaluates to TRUE.
I think that operation with OR conditions can be simplified. If first occurrence of such a condition evaluates to TRUE, then there is no need to evaluate conditions any further.
Comments
Post a Comment