![]() |
![]() |
Conditions |
A condition will be available with definitions by cases and
repetition loops. You can use the following operators:
x < y | is x smaller than y? |
x < = y | is x smaller or equal to y? |
x == y | is x equal to y? |
x > = y | is x larger or equal to y? |
x > y | is x larger than y? |
x! = y or alternatively x < > y | is x unequal y? |
x and y are arbitrary variables, values or expressions of the same type.
2 < 5is e.g. a correct comparison and supplies the result "true".
"two" < "five"is also a correct comparison, and supplies the result "wrong", because text is compared here, and "two" in the alphabet to "five" comes.
"two" < 5both are not permitted , since numbers and texts are compared here. For converting from numbers into texts and special functions exist in reverse text=str(zahl) and zahl=eval(text) , which are not to be explained here more near.
"2" < 5
If several conditions are to be combined, the logical operators and are available as well as or :
(x > 2) and ( y > 3)is fulfilled, if x is more largely 2 and at the same time y larger 3. Even if the clasping is not necessary, it is often recommended to the better legibility.