Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
You can chain if statements with else clauses together to create a sequence of expressions that get tested in order. The statement associated with the first expression to test true is executed; otherwise, the statement associated with the final (and optional) else clause is run. Here’s the form such a series would take:
if (expression1) statement1; else if (expression2) statement2; ... else if (expressionN) statementN; else statementN+1;