Commit 85e24cd
Jesús Gómez
Limit some examples to be just logical expression and not assignments
In the section "Why is using and and or as logical operators a bad idea?" ...
Notice the example following given example:
```
foo = true or true and false # => false (it's effectively (true or true) and false)
```
Yes, the whole expression is `false` but be careful: `foo` is `true`.
This phenomenal of problems with the assignment was already addressed by the previous example:
```
----
foo = true and false # results in foo being equal to true. Equivalent to (foo = true) and false
bar = false or true # results in bar being equal to false. Equivalent to (bar = false) or true
----
```
So my suggestion is to limit this last examples to just be logical expressions, or add for each one a new "column" for the variable value. Something enough to express:
expression # expression's value # variable's value
foo = true or true and false # false # true
foz = true || true && false # true # true
bar = false or true and false # false # false
baz = false || true && false # false # false1 parent fc0125e commit 85e24cd
1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1499 | 1499 | | |
1500 | 1500 | | |
1501 | 1501 | | |
1502 | | - | |
1503 | | - | |
1504 | | - | |
1505 | | - | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
1506 | 1506 | | |
1507 | 1507 | | |
1508 | 1508 | | |
| |||
0 commit comments