JPDev@programming.dev to Programmer Humor@programming.dev · 1 年前ifn'tprogramming.devimagemessage-square113fedilinkarrow-up1739
arrow-up1739imageifn'tprogramming.devJPDev@programming.dev to Programmer Humor@programming.dev · 1 年前message-square113fedilink
minus-squareLmaydev@programming.devlinkfedilinkarrow-up8·edit-21 年前It has a not keyword it’s used for pattern matching. if (x is not null)
minus-squareCaveman@lemmy.worldlinkfedilinkarrow-up2·1 年前Yeah, I just said it since you used it with null. I used it a lot for enums
minus-squareLmaydev@programming.devlinkfedilinkarrow-up1·edit-21 年前The 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
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