JPDev@programming.dev to Programmer Humor@programming.dev · 3 years agoifn'tprogramming.devimagemessage-square127linkfedilinkarrow-up1775arrow-down111
arrow-up1764arrow-down1imageifn'tprogramming.devJPDev@programming.dev to Programmer Humor@programming.dev · 3 years agomessage-square127linkfedilink
minus-squareLmaydev@programming.devdeleted by creatorlinkfedilinkarrow-up9·3 years agoIt has a not keyword it’s used for pattern matching. if (x is not null)
minus-squareLmaydev@programming.devdeleted by creatorlinkfedilinkarrow-up2·3 years agoPattern matching is different.
minus-squareCaveman@lemmy.worldlinkfedilinkarrow-up2·3 years agoYeah, I just said it since you used it with null. I used it a lot for enums
minus-squareLmaydev@programming.devdeleted by creatorlinkfedilinkarrow-up1·3 years 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
minus-squarePatches@sh.itjust.worksdeleted by creatorlinkfedilinkarrow-up2·3 years agoStuff can be two things
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