When you ask someone a boolean question....... and they return a string

cross-posted from: https://piefed.world/c/shit/p/1239627/when-you-ask-someone-a-boolean-question-and-they-return-a-string

105 points · 13 comments · view on lemmy.world

13 Comments

python@lemmy.world · 13 pts · 53d (1 reply)

Deep down, it's all [Object object] anyways

one_knight_scripting@lemmy.world · 1 pts · 50d

I object to your statement.

forkDestroyer@infosec.pub · 4 pts · 53d (1 reply)

True it is! Mwahahahahaahah!

Drekaridill@lemmy.wtf · 1 pts · 53d

"false"

idunnololz@lemmy.world · 3 pts · 53d

When you ask someone an enum question and they return a boolean.

Badabinski@kbin.earth · 3 pts · 53d (1 reply)

A string with length > 0 is truthy*, so we're good!

*in python

ReluctantMuskrat@lemmy.world · 2 pts · 53d

False is true!

LeFrog@discuss.tchncs.de · 2 pts · 53d (1 reply)

ELI5?

Badabinski@kbin.earth · 7 pts · 53d

In many programming languages, data comes in different forms. If you want to get a yes/no answer to something, there's a way to represent that: a true/false boolean (often 1 for true, and 0 for false). If you want to represent, say, a street address, that's a string, because it's just a big ol blob of undifferentiated text to the computer.

The joke is about how you ask someone a yes or no question, but they respond with something which is not either of those options.

gnufuu@lemmy.ca · 2 pts · 53d

Better avoid those types

dismay3915@lemmy.world · 1 pts · 53d

This belongs to programmer humor. Don't make us drop type theory and category theory on these poor non-programmers

village604@adultswim.fan · 1 pts · 53d

Or when they ask you a boolean question and get upset at a boolean answer.

Kenny2999@lemmy.world · 1 pts · 53d

Unless the question is "did you buy any clothes, dear?"