Skip to content

Latest commit

 

History

History
86 lines (58 loc) · 1.39 KB

File metadata and controls

86 lines (58 loc) · 1.39 KB

Boolean Operators

The boolean operators implemented in Kuifje.


And

The And operator is used to verify if two conditions are true at the same time.

Example - Comparison Of Numbers

Program:

x <- uniform [1, 2, 3];
y = (x < 3) && (x > 1);

Output or variable y:

Probability of the distribution happen Distribution Value
1.00 0.67 False
0.33 True

Or

The Or operator is used to verify if at least one of two conditions are valid.

Example - Comparison Of Numbers

Program:

x <- uniform [1, 2, 3];
y = (x < 2) || (x > 2);

Output or variable y:

Probability of the distribution happen Distribution Value
1.00 0.33 False
0.67 True

Not

The Not operator negates a boolean, it can be used to verify the opposite of a condition.

Example - Comparison Of Numbers

Program:

x <- uniform [1, 2, 3];
y = (x < 3) && (x > 1);
z = ~y;

Output or variable y:

Probability of the distribution happen Distribution Value
1.00 0.67 False
0.33 True

Output or variable z:

Probability of the distribution happen Distribution Value
1.00 0.33 False
0.67 True

Summary