Within the function, we define three code paths: if, else if, and else:
if <#a boolean expression#> {
<#executed if boolean expression above is true#>
} else if <#other boolean expression#> {
<#executed if other boolean expression above is true#>
} else {
<#executed if neither boolean expressions are true#>
}
First, we want to determine whether the ball is solid. Since we know that the balls numbered 1-7 are solid, we can test whether the ball number is less than 8, with number < 8. If this is true, we return the .solid case of our enum.
If it is false, the else if Boolean expression is evaluated. As balls 9-15 are striped, we can test whether the ball number is more than 8, with number > 8. If this is true, we return the .stripe case of our enum.
Lastly, if both the preceding Boolean expressions are false, we return the .black case of our enum, since that can only happen if the number is exactly 8.
The else...