Simplification of conditions #9646
Replies: 1 comment 4 replies
-
You can use pattern matching: Key is "xxx" or "yyy" |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The idea is the following - this condition:
if (Key == "954553" || Key == "954571") { Width = 1280; Height = 720; }
most probably can be written as:
if (Key == "954553" || == "954571") { Width = 1280; Height = 720; }
especially in case of long variables like: classA.PropertyB == "string" || classA.PropertyB == "string2"
Thx
Beta Was this translation helpful? Give feedback.
All reactions