Logic

Last modified by admin on 2023/05/29 10:32

Logical (Boolean) operators and constants

AND:

xyx AND y
FalseFalseFalse
FalseTrueFalse
TrueFalseFalse
TrueTrueTrue

If and only if both x and y are True the AND operator returns True, otherwise False.

OR:

xyx OR y
FalseFalseFalse
FalseTrueTrue
TrueFalseTrue
TrueTrueTrue

If and only if both x and y are False the OR operator returns False, otherwise True.

NOT:

xNOT x
FalseTrue
TrueFalse

The NOT operator returns the opposite of the input.

TRUE:

The TRUE operator can be used when having an if-clause, for example: If (x<0 = TRUE) then ...

FALSE

The FALSE operator can be used when having an if-clause, for example: If (x<0 = FALSE) then ...

With the logical operators you can for example connect an if condition: If number > 5 AND number < 10 is true then... This if-clause checks if the number is between 6 and 9.

For more details have a look here


Comparison operators

= (equals)

≠ (does not equal)

< (is less than)

≤ (is less or equal than)

> (is greater than)

≥ (is greater or equal than)

With the comparison operators you can check if a data is equal, greater than, less than...then another data.

For example:

1<2 gives you TRUE

2<1 gives you FALSE

1≤1 gives you TRUE

1≤0 gives you FALSE

1=1 gives you TRUE

1=2 gives you FALSE

1≠2 gives you TRUE

1≠1 gives you FALSE

For more details have a look here