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

Programmer Humor

32710 readers
826 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
[–] [email protected] 4 points 2 years 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.