Skip to content

Commit f5553dc

Browse files
authored
Merge pull request #501 from larskrjo/fix/ternary-operator-order
fix: Fixed ordering of ternary operator
2 parents 1cebfe1 + a6884ba commit f5553dc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/cheatsheet/control-flow.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,13 @@ Ternary operators can be chained:
207207
>>> print('kid' if age < 13 else 'teen' if age < 18 else 'adult')
208208

209209
>>> # is equivalent to this if statement:
210-
>>> if age < 18:
211-
... if age < 13:
212-
... print('kid')
213-
... else:
214-
... print('teen')
210+
>>> if age < 13:
211+
... print('kid')
215212
... else:
216-
... print('adult')
213+
... if age < 18:
214+
... print('teen')
215+
... else:
216+
... print('adult')
217217
...
218218
# output: teen
219219
```

0 commit comments

Comments
 (0)