Hacker News new | ask | show | jobs
by oriolid 2368 days ago
> Main reason why an if statement returns a value is because it is used to test if condition is true or false.

Uh, no. The condition itself is true or false. The return value is useful for assigning, passing as parameter, etc. Non-returning if requires dealing with temporary variable, which itself is verbose, doesn't automatically get assigned in both branches, doesn't play nice with C++-style move semantics, etc.

> What is awful about the variable syntax? This syntax was copied directly from C language.

C language is awful, but at least they have the excuse that nobody knew better in the 70s and const kind of works even the syntax is a bit complicated.