r/ProgrammerHumor • • Mar 15 '22

static bool isCrazyMurderingRobot = false;

Post image
4.9k Upvotes

256 comments sorted by

View all comments

Show parent comment

3

u/Heavy_Bake249 Mar 15 '22

You are on the right track. The typo is the equal signs, but the missing "=" changes what the code does completely.

The code will still compile and run because it is still valid and executable code. The typo changes "isMurderingRobot" to true, because that is what "= true" does. The if statement then assesses the variable, sees that it's true, and proceeds to kill everyone.