Optional curly brackets

Note that Java has required parens, as you just used there, because it has optional braces.

Rust makes the opposite choice, and has optional (even discouraged) parens around the condition, but required braces around the block:

if doHelloWord { println!("Hello world!"); }

Given that everywhere I've worked in C-like languages has ended up having a coding standard requiring braces even through they're optional in the language, I think Rust makes the better trade-off here.

61 Likes