Re:Lua, a Misunderstood Language (2021)
by bawolff on Thursday September 29, 2022 @01:31PM
(#33024244)
All these problems could be solved by just having ++ and += not return a value, which gets rid of all the confusing cases but keeps the useful cases.
[ Parent
| on HN ]
Re:Lua, a Misunderstood Language (2021)
by UncleEntity on Friday September 30, 2022 @10:15AM
(#33035123)
++ is useful to switch over the items of a string:
switch (x++) {
case ‘+’:
if (x == ‘+’) {
op = OP_INC;
x++;
} else if (x == ‘=‘) {
op = OP_ADDEQ;
x++;
} else {
op = OP_ADD;
}
break;
…
}