Multiple Conditions Examples

Conditions used as operands of AND (&&), OR (||), and NOT (!) must always be enclosed in brackets.

if (Number1 > 0 && Number1 < 100)

if (Number1 > 0 || Number1 < 100)

if !(Number1 == 0)

Compound conditions may be formed using the logical operators && along with ||. The negative of a condition is achieved by using the NOT (!) operator

For example, (Number1 > 0 && Number1 <= 10) will be true if Number1 is between 1 and 10. In other words, Number1 is greater than 0 AND it is also less than or equal to 10.

Next: Nested if Statements