ifnot #7817
Answered
by
ufcpp
kskog
asked this question in
Language Ideas
ifnot
#7817
-
Usually, I try to reduce nesting by checking conditions and returning as quickly as possible. This requires inverting of if statements. To improve readability, maybe you could add an ifnot or if! statement. instead of
one could write like this:
|
Beta Was this translation helpful? Give feedback.
Answered by
ufcpp
Jan 5, 2024
Replies: 2 comments
-
see #882 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
kskog
-
This is a side topic, but I find this an enjoyable way to handle examples like the one you shared. It's not always applicable, though. if (ev is not { Device.Type: DeviceType.Gateway, PropertyId: MtIdentifier.NetworkNode, IsChanged: true }) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
see #882