this post was submitted on 05 Dec 2024
226 points (93.1% liked)

Science Memes

11397 readers
2321 users here now

Welcome to c/science_memes @ Mander.xyz!

A place for majestic STEMLORD peacocking, as well as memes about the realities of working in a lab.



Rules

  1. Don't throw mud. Behave like an intellectual and remember the human.
  2. Keep it rooted (on topic).
  3. No spam.
  4. Infographics welcome, get schooled.

This is a science community. We use the Dawkins definition of meme.



Research Committee

Other Mander Communities

Science and Research

Biology and Life Sciences

Physical Sciences

Humanities and Social Sciences

Practical and Applied Sciences

Memes

Miscellaneous

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 61 points 1 week ago (16 children)

what would be the alternative? to always execute if the condition is true, but sometimes execute it even when false, for funsies?

[–] [email protected] 18 points 1 week ago (2 children)

The "only" part implies exclusivity, which may be false, because other things might run the code anyway.

IF "I can see the sun" THEN "It's day."

Nothing wrong about that. However if we make it exclusive:

IF AND ONLY IF "I can see the sun" THEN "It's day."

That's obviously wrong. I can actually not keep the day away by sitting with closed eyes in my mothers basement with the curtains shut.

"Only if" might make sense in a legal contract, but there's no way a piece of code can stop other pieces of code from calling the same functions.

[–] adj16 2 points 1 week ago (1 children)

But that’s not how if statements in code work. So what you’ve said isn’t wrong, but the premise of this meme is completely off

[–] [email protected] 2 points 1 week ago* (last edited 1 week ago)

Yes sure. Code is logical stepwise. By including the "only if" it implies that other stuff is taken into account, which it isn't at that moment in code.

I mean, I don't need to extend the implications of an IF statement. It already does exactly what it says.

Anyway fuzzy logic does exist for people who want "sometimes if". It's useful in certain cases. I've only ever considered it in music production, where things very often get to the point of complexity where it makes a (sometimes) useful difference.

load more comments (13 replies)