Show last authors
author | version | line-number | content |
---|---|---|---|
1 | ==== Logical (Boolean) operators and constants ==== | ||
2 | |||
3 | AND: | ||
4 | |||
5 | |x|y|x AND y | ||
6 | |False|False|False | ||
7 | |False|True|False | ||
8 | |True|False|False | ||
9 | |True|True|True | ||
10 | |||
11 | If and only if both x and y are True the AND operator returns True, otherwise False. | ||
12 | |||
13 | |||
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 | |||
39 | FALSE | ||
40 | |||
41 | The FALSE operator can be used when having an if-clause, for example: If (x<0 = FALSE) then ... | ||
42 | |||
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 | |||
46 | For more details have a look [[here>>https://en.wikipedia.org/wiki/Boolean_algebra#Basic_operations]] | ||
47 | |||
48 | ---- | ||
49 | |||
50 | ==== Comparison operators ==== | ||
51 | |||
52 | ~= (equals) | ||
53 | |||
54 | ≠ (does not equal) | ||
55 | |||
56 | < (is less than) | ||
57 | |||
58 | ≤ (is less or equal than) | ||
59 | |||
60 | ~> (is greater than) | ||
61 | |||
62 | ≥ (is greater or equal than) | ||
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 | |||
70 | 2<1 gives you FALSE | ||
71 | |||
72 | 1≤1 gives you TRUE | ||
73 | |||
74 | 1≤0 gives you FALSE | ||
75 | |||
76 | 1=1 gives you TRUE | ||
77 | |||
78 | 1=2 gives you FALSE | ||
79 | |||
80 | 1≠2 gives you TRUE | ||
81 | |||
82 | 1≠1 gives you FALSE | ||
83 | |||
84 | For more details have a look [[here>>https://en.wikipedia.org/wiki/Relational_operator]] |