More minor cleanup of the command tutorial page

This commit is contained in:
Griatch 2023-09-23 22:33:59 +02:00
parent 8e10db5dca
commit 7d99d319a5

View file

@ -349,17 +349,15 @@ The full form of the if statement is
else: else:
... ...
There can be any number of `elifs` to mark when different branches of the code should run. If There can be any number of `elifs` to mark when different branches of the code should run. If `else` is provided, it will run if none of the other conditions were truthy.
the `else` condition is given, it will run if none of the other conditions was truthy. In Python
the `if..elif..else` structure also serves the same function as `case` in some other languages.
``` ```
- **Line 15** has our first _conditional_, an `if` statement. This is written on the form `if <condition>:` and only if that condition is 'truthy' will the indented code block under the `if` statement run. To learn what is truthy in Python it's usually easier to learn what is "falsy": - **Line 15** has our first _conditional_, an `if` statement. This is written on the form `if <condition>:` and only if that condition is 'truthy' will the indented code block under the `if` statement run. To learn what is truthy in Python it's usually easier to learn what is "falsy":
- `False` - this is a reserved boolean word in Python. The opposite is `True`. - `False` - this is a reserved boolean word in Python. The opposite is `True`.
- `None` - another reserved word. This represents nothing, a null-result or value. - `None` - another reserved word. This represents nothing, a null-result or value.
- `0` or `0.0` - `0` or `0.0`
- The empty string `""` or `''` or `""""""` or `''''''` - The empty strings `""`, `''`, or empty triple-strings like `""""""`, `''''''`
- Empty _iterables_ we haven't seen yet, like empty lists `[]`, empty tuples `()` and empty dicts `{}`. - Empty _iterables_ we haven't used yet, like empty lists `[]`, empty tuples `()` and empty dicts `{}`.
- Everything else is "truthy". - Everything else is "truthy".
- **Line 16**'s condition is `not args`. The `not` _inverses_ the result, so if `args` is the empty string (falsy), the whole conditional becomes truthy. Let's continue in the code: - **Line 16**'s condition is `not args`. The `not` _inverses_ the result, so if `args` is the empty string (falsy), the whole conditional becomes truthy. Let's continue in the code: