Thursday, January 21, 2010

Real world examples of basic programming elements

Variables: "So, what are you going to name your kid?"

For loops: "My job is so boring. Every hour, I have to check the temperature on this gauge, and if it ever overloads, I just flip a switch to cool it down."

While loops: "Every day when I get up, I go fishing in the morning. I'll probably stop once I get older."

If statements: "When they get here, I'm not gonna let them in unless they're carrying a white flag."

Parameters: "What do you want on your pizza?"

Return values: "Hey, I'm back from the store. Here's those taco ingredients you wanted."

Any other ideas?