→Logical short-cut evaluation
mNo edit summary |
|||
| Line 7: | Line 7: | ||
For instance: | For instance: | ||
MySVTable = MySVTable or {}; | MySVTable = MySVTable or {}; | ||
print(UnitExists("target") and "You have a target" or "You don't have a target" | print(UnitExists("target") and "You have a target" or "You don't have a target"); -- As a trigraph | ||
A notable limitation of using short-cut evaluation as a trigraph operator is that if the ''true'' expression may return a false value, the false expression will be returned: | A notable limitation of using short-cut evaluation as a trigraph operator is that if the ''true'' expression may return a false value, the false expression will be returned: | ||