JPDev to Programmer Humor · 10 months agoifn'timagemessage-square127fedilinkarrow-up1774arrow-down111
minus-squareCaveman@lemmy.worldlinkfedilinkarrow-up26·10 months agoI’d take a not or “if not” operator tbh.
minus-squareLmaydevlinkfedilinkarrow-up9·edit-210 months agoIt has a not keyword it’s used for pattern matching. if (x is not null)
minus-squareCaveman@lemmy.worldlinkfedilinkarrow-up2·10 months agoYeah, I just said it since you used it with null. I used it a lot for enums
minus-squareLmaydevlinkfedilinkarrow-up1·edit-210 months agoThe type matching is the most common thing I use it with. Combined with inline variables. if (x is string { Length: 5} s) { // do stuff with s } And switch expressions. As a side note inline variables are amazing haha
I’d take a
not
or “if not” operator tbh.It has a not keyword it’s used for pattern matching.
It also has a
!=
.Pattern matching is different.
Yeah, I just said it since you used it with null. I used it a lot for enums
The type matching is the most common thing I use it with. Combined with inline variables.
And switch expressions.
As a side note inline variables are amazing haha
Stuff can be two things
ifnt instead of ifn’t