-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ternary operator in multiple lines #10291
Comments
You just need to put the colon on the same line as the question mark:
|
Alternatively, you can use parentheses:
|
I mean, this is intended behavior? We really need the parenthesis there? |
Maybe you could argue that the the parser, having seen a |
@IainNZ C allows the break before the semicolon: int main()
{
int foo = 1 > 0 ? 1
: 0;
} |
There's also been some discussion of allowing just the |
Yeah, I was a bigger fan of allowing single line if-then statements, so you if x then y instead of if x; y; end On Sun, Feb 22, 2015 at 9:34 PM, Stefan Karpinski notifications@github.com
|
Yes, that is #6823. Even if we don't adopt the |
The parser fails with the ternary operator in two lines:
The text was updated successfully, but these errors were encountered: