4 ms·
return { ok: false }; Have you seen this part of the video? That's a perfect example while adding semicolons is a bad thing.
by babo 18y ago
return
{
ok: false
};
Have you seen this part of the video? That's a perfect example while adding semicolons is a bad thing.
- inimino 18y agoSo write that as any of: return {ok:false}; return { ok: false }; return( { ok: false }); The semicolon insertion feature isn't a "bad thing," just a matter of personal preference and something you have to be aware of.
- joechung 18y agoNo, it's a bad thing. It's a false economy that causes bugs.
- olavk 18y agoSemicolon insertion is a bad thing, because it is unintuitive and may lead to subtle bugs. If the rule was straightfoward, like a newline always corresponds to an automatic semicolon, then it would be OK. Now the rule require you to have a pretty deep understanding of the language grammar, to determine when a newline changes the semantics. The intention was good: to optionally allow a more line-oriented syntax like Python, but it turns out that this just dot fit well with c-style syntax.