1. ## Not, And, Or?

Hello again,

I was checking out the second part of the tutorials here on the site, the one on "if statments".The part i dont get is the"! for not" and "&& for AND", and the "ll for OR" I understand what they are and what they mean, i just dont get where they would be put or inserted into a code block, or are they out of the code block?
also what is the sign for the Boolean OR is it two L's like this ll, because i dont have a key that looks like that on my keyboard.
any info to clear this up is greatly appreciated.

2. || are NOT two ells (lower case L), on my keyboard they are shift-\ key next to the + key. And || is the symbol for boolean OR.

Let's say you have an integer a those value can be either 1 or 2
Code:
```if( a == 1 || a == 2)
{
// blabla
}```
now lets say you have integer a and b, one must be 1 and b must be 2
Code:
```if( a == 1 && b == 2)
{
// blabla
}```

3. They're logical operators, meaning they take boolean values. Basically, they do what they say. If you take their operands and read their boolean results out with the operator. The results are pretty logical.
Code:
```(2 > 1 || 4 == 5) == true  // in other words

(true OR false) == true

(2 < 1 && 4 == 5) == false  // in other words

(false AND false) == false

!(4 > 2) == false   // in other words

NOT (true) == false```
You see? They're mostly used in if statements, or anything else that takes a logical result. So
Code:
```if(4 > 2 && 1 < 3) // if(true && true)
{
// do this
}
else
{
// do that
}```

4. The key for | might look like this on your keyboard:
Code:
```|
|```
You obviously have to use two for the boolean OR.

If that key doesn't exist on your keyboard, then you can just use or itself as a keyword, although that shouldn't be necessary for most people.

5. ok i get that now, so all i would have to do is put that (of coarse modified for the program) into a "if"statment if i needed them? also what type of program would the logical operators be used for?
thanks

6. Originally Posted by GeForzme
also what type of program would the logical operators be used for?
thanks
all (most) programs of any significant size will use them. They are used so frequently you will learn to use them in your sleep

7. [QUOTE=Ancient Dragon]all (most) programs of any significant size will use them. They are used so frequently you will learn to use them in your sleep [/QUOTE

cool, thanks alot, i hope i can put this all into good use.