The if/else statement is a cornerstone of almost every programming language. It enables code to be executed conditionally, based on the outcome of a Boolean statement.
Making decisions with if/else
Getting ready
If you have ever played pool, you'll know that the aim of the game (when playing standard 8-ball pool) is to pot all the balls of one type and then to pot the black ball. When using American pool balls, they are numbered 1-15, and have a different pattern depending on their type. Balls 1-7 have a solid color, balls 9-15 are white with a colored stripe around them, and ball 8 is black.
Let's write a function that will take the number on the pool ball and return to us the type of ball it is.