-
Notifications
You must be signed in to change notification settings - Fork 213
if - assignment operator #820
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
Comments
var s1 = 3;
if (s1 > 3) s1 = 10050; is more readable imo. |
Ok, but these
are more readable than these
But for some reasons they exist ... |
Which is why I think dart should support if expressions (I think there's another issue for it). These operators, though short, severely affect readibility. |
Sounds logical, I like the idea about "ignore" |
I'm not seeing the big advantage (or readability improvement) of It's not an impossible idea, we have The conditional operator (the |
@lrhn I think folks really want a condition expression without an "else" clause. For example there are many requests for: Obj(
param: if (condition) value
) And we can already do it with collection litterals. To me, this is just another take on the topic. |
I want an
List elements can always be omitted, so it makes sense to use element semantics Parameters are interesting, because optional parameters can be omitted, required cannot. Looking at So, allowing only one meaning is more likely: Allow a single-value element expression for optional parameters (and allow omitting non-trailing optional positional parameters). And then it's not an expression. |
At the moment Dart has ternary operator that requires "else" part.
In the cases when I need something like this
": s1" is redunant.
Or I should use "if"
I think It will be useful to have another one aproach to do this, something like this:
If the condition is false than all expression ignors. And the old value will not change.
This is something like collection "if" but witout collection.
The text was updated successfully, but these errors were encountered: