this post was submitted on 16 Jun 2023
27 points (100.0% liked)

Programmer Humor

854 readers
12 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] PlexSheep@feddit.de 2 points 1 year ago

I wrote an exam about this stuff yesterday.

In J's equality is usually checked in a way that variables are casted to the type of the other one. "25" == 25 evaluates to truey because the string converted to int is equal to the int and the other way around.

You can however check if the thing is identical, using "25" == 25 which skips type conversion and would evaluate as false.

I assume the same thing happens here, null is casted to int, which gets the value 0.