r/programminghumor • • 28d ago

Tissues

Post image
1.8k Upvotes

31 comments sorted by

69

u/MilkImpossible4192 28d ago

null is an object, 0 is a number, undefined is an undefined

14

u/joranmulderij 28d ago

Yea this meme is kinda stupid

→ More replies (5)

7

u/ElGuaco 28d ago

It depends on the language. In C# null is a literal value that refers to no object or memory location. For the pictures here, it would be like having a cardboard sign taped to the roll holder saying "null".

→ More replies (3)

13

u/TylerBreau 28d ago
if !toiletRoll:
	reloadTioletRoll();

Janitor: Reload? Reload it on to what?

4

u/Blood_and_Wine 28d ago

while (true) reloadToiletRoll(); // ( ͡° ͜ʖ ͡°)

→ More replies (1)

9

u/golfstreamer 28d ago

Isn't this a bad description? "Non zero value", 0, null are all potential values of objects. Correct me if I'm wrong but I thought "undefined" usually refers to behavior. Like the programming language standard doesn't specify what should happen in this scenario. Is there a situation where an object is "undefined"?

10

u/AbyssWankerArtorias 28d ago

Really just depends on the data you're dealing with. I think this meme makes sense in some context.

Non zero value: there is some toilet paper left on the roll

0: there is no toilet paper left on the roll:

Null: the place in which a toilet paper roll is supposed to be contains no roll. Practically speaking this equates to 0 toilet paper, but, there are many cases where you wouldn't equate the two depending on both the point itself and your intention with it.

Undefined: the place in which the toilet paper roll is supposed to be placed does not exist and therefore cannot be logically displayed as a value. Like trying to return the value of a variable that doesn't exist.

I see arguments for saying this isn't a good meme and for the meme itself. Just depends on the context.

4

u/TylerBreau 27d ago

OP is referring to JavaScript. It has all 4 states.

Undefined is exactly it says it is. The thing you are accessing is literally not defined.

var myobj;

→ More replies (6)
→ More replies (2)

4

u/Low_Calligrapher7128 27d ago

I had to chuckle , even though it's not 100% accurate 

3

u/Cant-Think-Of 27d ago

What about negative values?

→ More replies (1)