Allow left-side 'and', 'or' pattern #4130
Replies: 4 comments 8 replies
-
What problem does this solve? Being terser isn’t in itself sufficient reason to introduce another way to do something that’s already possible. |
Beta Was this translation helpful? Give feedback.
-
This isn't criticism of the proposal, but for if (obj is {Prop1: not null, Prop2: not null}) {
// ...
} |
Beta Was this translation helpful? Give feedback.
-
This is an interesting idea, and I'd like to see a few things related to it:
|
Beta Was this translation helpful? Give feedback.
-
How would this interact with patterns that assign variables? Consider e.g. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone! This topic will introduce the
and
andor
patterns on the left side of the keywordis
. In this way we can simplify the code:Normal check
Recursive pattern
Thank you. If duplicate, sorry for that.
Beta Was this translation helpful? Give feedback.
All reactions