# Logical Operators in LISP

• Last Updated : 22 Oct, 2021

Common LISP supports 3 types of logical operators on Boolean Values. The arguments of these operators are evaluated conditionally, therefore they are also part of the LISP control Structure.

The common LISP operators are listed below in the table:

Example: LISP Program that demonstrates Logical operators on numbers

## Lisp

 `;set value ``1` `to ``50``; set value ``2` `to ``50``(setq val1 ``50``)``(setq val2 ``50``)` `;and operator``(print (and val1 val2))` `;or operator``(print (or val1 val2))` `;``not` `operator with value1``(print (``not` `val1))` `;``not` `operator with value2``(print (``not` `val2))`

Output:

```50
50
NIL
NIL ```

Example 2: LISP Program to demonstrate Logical operators on Boolean values

## Lisp

 `;set value ``1` `to T``; set value ``2` `to NIL``(setq val1 T)``(setq val2 NIL)` `;and operator``(print (and val1 val2))` `;or operator``(print (or val1 val2))` `;``not` `operator with value1``(print (``not` `val1))` `;``not` `operator with value2``(print (``not` `val2))`

Output:

```NIL
T
NIL
T ```

My Personal Notes arrow_drop_up