Yogesh Chauhan's Blog

# AND, OR and NOT boolean operators in Envision Basic

in Envision Basic on January 3, 2022

## The AND Boolean operator

The AND Boolean operator in Envision Basic, just like any other programming language, combines a set of expressions.

So, if both expressions are false, then the combined expression is false too.

In other words, both expressions needs to be true for the combined expressions to be true.

### Syntax

``````
expression1 AND expression2
```
```
``````
expression1 & expression2
```
```

### Example

``````
X = 1 ; Y = 2 ; Z = 3
IF (X < Y) AND (Y < Z) THEN REPROMPT
END
```
```

## The OR Boolean operator

The OR Boolean operator in Envision Basic, combines a set of expressions.

So, if both expressions are false, then and then the combined expression is false.

In other words, any one expression needs to be true in order for the combined expressions to be true.

### Syntax

``````
expression1 OR expression2
```
```
``````
expression1 ! expression2
```
```

### Example

``````
X = 1 ; Y = 2 ; z = 3
IF (X < Y) OR (Y < Z) THEN GOSUB RETRY:
```
```

## The NOT Boolean operator

The NOT Boolean operator in Envision Basic reverses the logical result of the argument expression.

If the expression is true, the function returns false (0).

If the expression is not true, the function returns true (1).

### Syntax

``````
NOT(expr)
```
```

### Example

The condition won't be satisfied and THEN statement will be executed.

``````
X = 1 ; Y = 2
IF NOT(X > Y) THEN GOSUB RETRY:
```
```