Hide last authors
author | version | line-number | content |
---|---|---|---|
2.1 | 1 | ==== Logical (Boolean) operators and constants ==== | |
2 | |||
5.1 | 3 | AND: | |
2.1 | 4 | ||
5.1 | 5 | |x|y|x AND y | |
6 | |False|False|False | ||
7 | |False|True|False | ||
8 | |True|False|False | ||
9 | |True|True|True | ||
2.1 | 10 | ||
5.1 | 11 | If and only if both x and y are True the AND operator returns True, otherwise False. | |
2.1 | 12 | ||
13 | |||
5.1 | 14 | OR: | |
15 | |||
16 | |x|y|x OR y | ||
17 | |False|False|False | ||
18 | |False|True|True | ||
19 | |True|False|True | ||
20 | |True|True|True | ||
21 | |||
22 | If and only if both x and y are False the OR operator returns False, otherwise True. | ||
23 | |||
24 | |||
25 | NOT: | ||
26 | |||
27 | |x|NOT x | ||
28 | |False|True | ||
29 | |True|False | ||
30 | |||
31 | The NOT operator returns the opposite of the input. | ||
32 | |||
33 | |||
34 | TRUE: | ||
35 | |||
36 | The TRUE operator can be used when having an if-clause, for example: If (x<0 = TRUE) then ... | ||
37 | |||
38 | |||
2.1 | 39 | FALSE | |
40 | |||
5.1 | 41 | The FALSE operator can be used when having an if-clause, for example: If (x<0 = FALSE) then ... | |
2.1 | 42 | ||
5.1 | 43 | ||
44 | 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. | ||
45 | |||
2.1 | 46 | For more details have a look [[here>>https://en.wikipedia.org/wiki/Boolean_algebra#Basic_operations]] | |
47 | |||
48 | ---- | ||
49 | |||
50 | ==== Comparison operators ==== | ||
51 | |||
5.1 | 52 | ~= (equals) | |
2.1 | 53 | ||
5.1 | 54 | ≠ (does not equal) | |
2.1 | 55 | ||
5.1 | 56 | < (is less than) | |
2.1 | 57 | ||
5.1 | 58 | ≤ (is less or equal than) | |
2.1 | 59 | ||
5.1 | 60 | ~> (is greater than) | |
2.1 | 61 | ||
5.1 | 62 | ≥ (is greater or equal than) | |
2.1 | 63 | ||
64 | With the comparison operators you can check if a data is equal, greater than, less than...then another data. | ||
65 | |||
66 | For example: | ||
67 | |||
68 | 1<2 gives you TRUE | ||
69 | |||
3.1 | 70 | 2<1 gives you FALSE | |
71 | |||
72 | 1≤1 gives you TRUE | ||
73 | |||
74 | 1≤0 gives you FALSE | ||
75 | |||
2.1 | 76 | 1=1 gives you TRUE | |
77 | |||
78 | 1=2 gives you FALSE | ||
79 | |||
3.1 | 80 | 1≠2 gives you TRUE | |
2.1 | 81 | ||
3.1 | 82 | 1≠1 gives you FALSE | |
2.1 | 83 | ||
84 | For more details have a look [[here>>https://en.wikipedia.org/wiki/Relational_operator]] |