---
title: "Logical operators"
canonical: "https://docs.cuesystem.com/space/CVCHELP/524353936/Logical%20operators"
format: markdown
---
> Macro (toc)

---

# And

The operator is logical and is evaluated as a logical conjunction of two expressions. If both expressions evaluate as True, a result is True. If either expression evaluates to False, the result is False. 

#### And 

|  |  |  |
| --- | --- | --- |
| Expression1 | Expression2 | Result |
| False | False | False |
| False | True | False |
| True | False | False |
| True | True | True |

#### Syntax 

```visualbasic
Result := Expression1 And Expression2
```

#### Example 

```visualbasic
Var a As Boolean := True 
Var b As Boolean := False 

If a And b Then 
  // ... 
End If
```

# Not

The operator logical not is evaluated as True if an Expression is False. It is evaluated as False if the Expression is True. 

#### Not 

|  |  |
| --- | --- |
| Expression | Result |
| False | True |
| True | False |

#### Syntax* *

```visualbasic
Result := Not Expression
```

#### Example 

```visualbasic
Var a As Boolean := True 

If Not a Then 
  // ... 
End If
```

# Or

The operator is logical or is evaluated as a logical disjunction on two expressions. If both expressions evaluate as False, the result is False. If either expression evaluates to True, the result is True. 

#### Or 

|  |  |  |
| --- | --- | --- |
| Expression1 | Expression2 | Result |
| False | False | False |
| False | True | True |
| True | False | True |
| True | True | True |

#### Syntax 

```visualbasic
Result := Expression1 Or Expression2
```

#### Example 

```visualbasic
Var a As Boolean := True 
Var b As Boolean := False 

If a Or b Then 
  // ... 
End If
```

# Xor

The operator logical xor is evaluated as a logical exclusion on two expressions. If just one of the expressions evaluates to True, the result is True. 

#### Xor 

|  |  |  |
| --- | --- | --- |
| Expression1 | Expression2 | Result |
| False | False | False |
| False | True | True |
| True | False | True |
| True | True | False |

#### Syntax 

```visualbasic
Result := Expression1 Xor Expression2
```

#### Example 

```visualbasic
Var a As Boolean := True 
Var b As Boolean := False 

If a Xor b Then 
  // ... 
End If
```