A Compound Ternary Operation
This is a pretty simple, but compound, ternary operation. If the name is Satis I greet the master, if the name is Shiny I greet the Mistress, if the Name is Pig or Ox I greet the Grabber, otherwise I greet the slave. This can become as complex as you want it to. Feel free to mix in other variables and comparisons in there, group them with parenthesis and do whatever else you want. Just remember, you have to be able to go back to your code a month (or a year) after you've written it and be able to figure out what it was you were doing. This isn't always as easy as it sounds.
Next we're going to look at another variation of the if - then - else statement, the Switch - Case.