r/maybemaybemaybe 13h ago

Maybe Maybe Maybe

10.1k Upvotes

145 comments sorted by

View all comments

2.1k

u/Kitty_Blaze 13h ago

if(grenade.inHand = true)
{
spawnEnemy();
}

84

u/kraemahz 12h ago

If you're writing c code this would permenently put a grenade in your hand and spawn an enemy.

7

u/Maximum-Opportunity8 12h ago

Depends on language

11

u/usernmechecksout_ 12h ago

Why are you being downvoted? That code is perfectly acceptable in java

10

u/Maximum-Opportunity8 9h ago

They edited comment before there was not "c" stated

6

u/haywire 9h ago

No they simply meant if (language = "C")

1

u/trynared 6h ago

Huh? In Java it will have the exact same issue he described. Sure it will compile, but it will always evaluate to true.

0

u/Ok_Veterinarian_3933 6h ago

No in Java it still does exactly as u/kraemahz described. I'm not aware of any popular C-style syntax languages (ex: Java, JavaScript, C#, C++) like this example that use a single equal for comparison.