if not syntax #4143
-
Since if not (something.IsValid) instead of if(!something.IsValid) Yep, new version is a little bit longer, but it looks more readable and obvious if not (something1 op1 something2 op2 something3) instead of if (!(something1 op1 something2 op2 something3)) (yeah, it's possible to use de morgan's laws here, but it doesn't matter) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
The general consensus is that |
Beta Was this translation helpful? Give feedback.
-
'twas a joke, I couldn't help it ;) I know it has nothing to do with the proposal |
Beta Was this translation helpful? Give feedback.
if not
is basically the same as Ruby'sunless
. I'm sure there was a proposal for that, but it's really hard to search for....The general consensus is that
unless
is more confusing than not when applied with multiple conditions (sometimes it works, but most of the time it takes some effort to parse), and is pointless when combined withelse
.