Parenthesis around if/for/while condition is not necessary
Jacob Carlborg
doob at me.com
Sun Jun 24 08:30:28 UTC 2018
On 2018-06-23 14:34, Tobias Müller wrote:
> AFAIK the if and else branches in Rust always have to be enclosed in curly
> braces because of this.
> I don't remember the exact ambiguity though.
There's an ambiguity between the condition and the body. There needs to
be some kind of symbol to separate the two. In D, that's the closing
parenthesis (technically the opening parenthesis is not necessary but
unbalanced parentheses look weird for humans). In Rust it's the opening
curly brace.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list