Buckets and Buckets of Zombie Guts
One of the first things to understand is a concept called variables. Variables are like buckets you store things in. You can put water in a bucket or your lunch or a mannequin head or the rookie cards of the 2037 Los Angeles Zombie-Dodgers Human Resistance Cell. You can put just about anything in a bucket.
Numbers: These are what you think they are.
“Hello Post-Apocalyptic World”
“Don’t look at me, Norm. The zombie pulled your lunch out of the fridge and ate it.”
“I know you labeled it. The zombie didn’t care or couldn’t read.”
“Only one way to find out. He’s over there eating 7 other lunches.”
So you can have number characters in a string too, but they’ll behave as strings and not as numbers—so you can’t add or multiply them without converting them back to numbers. If something is in quotes, it’s a string.
Boolean: The value is true or false and can’t be anything else. This makes it great for using it like a switch to turn something on or off.
Buckets of Type Z
Some buckets can only hold one type of thing. For instance, a bucket with a hole in the bottom wouldn’t hold water or the soda from the last working soda fountain in North America, but it could be great for holding books or large rocks or the personal effects of your zombified roommate. Similarly, variables often only hold one type of thing.
Variable Bucket Contents
These buckets we’ve been talking about are called variables. They’re called variables because they are…ahem…variable. You can put something in them, and, during your program, you can take that out and look at it or take it out and do something with it or take it out and put something else in. You can do that any number of times.
Before we can use these buckets/variables to beat back the zombie hordes, we have to name them. We can name a variable just about anything we want. However, we can only use letters, numbers, and underscores. We can’t use any other characters, and the first character can’t be a number—i.e., 7zombies is invalid, but sevenzombies or _7zombies or zombies_numbering_7 would all work just fine.
Also, variables are case sensitive, so a variable of zombie is different from a variable of Zombie, which is also different from a variable named ZOMBIE, which is different from zOmBiE—so watch which case you use, and use that case throughout your code.