1. ## && or ||

Hi

Is it possible for someone to explain to me when using the boolen expressions && and || when each one should be used I keep making the mistake of using && when it should be || or vice and versa.

So

or is it

thanks

2. Your first if statement evaluate as true if variable answer is a number between 5 and 10.
Second if statement is true for any numbe.

|| is ismilar to union and && to intersection.

Check this (just for logic):
http://www.themathlab.com/geometry/s...tersection.htm

- Micko

I at least completely understand && now.

Okay I am going to act dum however, it's only way I will finally understand this,

Why would || be for any number?

Thank you

4. You have ( cond1 || cond 2 ) as a single expression, which could be either true or false. What or ( || ) does is to say, "the expression is true when at least one of cond1 or cond2 is true, and false otherwise." Or, you could say, "the expression is true if cond1 is true, cond2 is true, or both are true, and false otherwise."

5. Right I understand

Thanks