mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Update lint.md
This commit is contained in:
parent
8a39ca5a68
commit
40322e96b8
1 changed files with 6 additions and 0 deletions
|
@ -311,3 +311,9 @@ In Lua, there is no first-class ternary operator but it can be emulated via `a a
|
|||
-- The and-or expression always evaluates to the second alternative because the first alternative is false; consider using if-then-else expression instead
|
||||
local x = flag and false or true
|
||||
```
|
||||
|
||||
The code above can be rewritten as follows to avoid the warning and the associated bug:
|
||||
|
||||
```lua
|
||||
local x = if flag then false else true
|
||||
```
|
||||
|
|
Loading…
Add table
Reference in a new issue