# Logical and: &&, and, AndAlso

Logical and works as follows: just in case it's true if both inputs are true in all other situations the result is false. In next table you can find all possibilities:
abx
FalseFalseFalse
FalseTrueFalse
TrueFalse False
True True True
information about the table: a, b are inputs, x is result

## &&

### Description

``par1 && par2``
Used keywords: &&

### Output

If the first operand is false, then the second operand is not evaluated.
Compatible programing languages:
C | Visual C++ .NET | C++ | C# | Java | JavaScript | PHP

### Example

In the source code you can find the equivalent of the above table, for easier orientation at the end of each line is a comment which shows the result.
``````a1 = false && false; // a1 = false
a2 = false && true; // a2 = false
a3 = true && false; // a3 = false
a4 = true && true;  // a4 = true``````

### Example

Even one example in what situations we can use the operation logical and:
``````a && b
a && true
10 >a && a>5
``````

### Example

Other pieces of example codes:
`!b && true`
`a && b`
` b2 = x && y`

## and

### Description

``par1 and par2``
Used keywords: and

### Output

If the first operand is false, then the second operand is not evaluated.
Compatible programing languages:
Pascal | Object Pascal | Free Pascal | PHP

### Object Pascal

In the source code you can find the equivalent of the above table, for easier orientation at the end of each line is a comment which shows the result.
``````a1 := false and false; // a1 = false
a2 := false and true; // a2 = false
a3 := true and false; // a3 = false
a4 := true and true;  // a4 = true``````

### Object Pascal

Even one example in what situations we can use the operation logical and:
``````a and b
a and true
10 >a and a>5
``````

### Object Pascal

Other pieces of example codes:
`b2:= x and y;`
`a and b`
`not b and true`

## and

### Description

``par1 and par2``
Used keywords: and

### Output

Both operands are evaluated independently of the value of the first operand.
Compatible programing languages:
Visual Basic .NET | FreeBASIC

### Visual Basic .NET

In the source code you can find the equivalent of the above table, for easier orientation at the end of each line is a comment which shows the result.
``````a1 = false and false ' a1 = false
a2 = false and true ' a2 = false
a3 = true and false ' a3 = false
a4 = true and true  ' a4 = true``````

### Visual Basic .NET

Even one example in what situations we can use the operation logical and:
``````a and b
a and true
10 >a and a>5
``````

### Visual Basic .NET

Other pieces of example codes:
`not b and true`
`a and b`
`Dim b2 As boolean= x and y`

## AndAlso

### Description

``par1 AndAlso par2``
Used keywords: andalso

### Output

The second operand is evaluated only in the case when the value of the first operand is true.
Compatible programing languages:
Visual Basic .NET | FreeBASIC

### Visual Basic .NET

In the source code you can find the equivalent of the above table, for easier orientation at the end of each line is a comment which shows the result.
``````a1 = false AndAlso false ' a1 = false
a2 = false AndAlso true ' a2 = false
a3 = true AndAlso false ' a3 = false
a4 = true AndAlso true  ' a4 = true``````

### Visual Basic .NET

Even one example in what situations we can use the operation logical and:
``````a AndAlso b
a AndAlso true
10 >a AndAlso a>5
``````

You can find it in the following collections: logical operators
Logical and in another programming language:
Languages: en hu cz sk