2 ms·
It's a really minor point, but this is one thing I like about Rust syntax for conditionals vs. C/C++. It always requires the {} around the block, so it has no s
by jabl 4y ago
It's a really minor point, but this is one thing I like about Rust syntax for conditionals vs. C/C++. It always requires the {} around the block, so it has no special rule for single-statement conditionals like C. At the same time, always requiring the {} means that it can get rid of the () around the condition. So all in all, it's as short or shorter than the C style syntax, and clearer without special cases.
- medo-bear 4y agothis sounds so silly to people writing in s-expressions
- rob74 4y agoLooks like several newer languages adopted that idea - Go does it too (also getting rid of the round brackets for loops and conditions, as well as of semicolons at the end of lines), but I'm not sure who started it...