Else-if statements

An else if statement after an if statement provides an alternate condition and set of instructions to execute.

The condition is only evaluated if the condition in the previous if statement evaluated to false. There can be any number of else if statements after an if statement.

Loading TypeScript...

Typescript can make further inference on the data type of a value based on the evaluation of if and else if statements.

Loading TypeScript...

Was this page helpful?