3 ms·
Sometimes the extra options can produce unexpected problems. For example, in JavaScript, this would return nothing and may result in an unreachable code warning
by Minor49er 5y ago
Sometimes the extra options can produce unexpected problems. For example, in JavaScript, this would return nothing and may result in an unreachable code warning:
function go() {
return
5 + 3;
}
console.log(go())
Since semicolons are optional, it's treating "return" as its own statement and "5 + 3" as a separate one.
There are no hidden gotchas like this in PHP though since semicolons are always used:
function go() {
return
5 + 3;
}
var_dump(go());
This will return int(8).