eradicator wrote: ↑Sat May 25, 2019 2:42 pm

What gets me again and again is the fake/pseudo ternary operation in lua though:

Code: Select all

```
a = nil
b = false
c = 0
x = a and b or c
```

I actually like that part, when I understand it.

First the order of operations, And before Or.

so you have a and b. a returns false, and b is false, so, either way it's false.

false or c, C is 0, which Klonan said is true, so... false or c returns 0, because false or true is true, so the true value gets passed.

therefore x = 0.

Also, in these cases, the first (left to right, or Boolean breakdown) true value is always used first too.