Shown below is the general form of a typical decision-making structure found in most of the programming languages −
A decision-making construct evaluates a condition before the
instructions are executed. Decision-making constructs in TypeScript are
classified as follows −| S.No. | Statement & Description |
|---|---|
| 1. | if statement An ‘if’ statement consists of a Boolean expression followed by one or more statements. |
| 2. | if...else statement An ‘if’ statement can be followed by an optional ‘else’ statement, which executes when the Boolean expression is false. |
| 3. | else…if and nested if statements You can use one ‘if’ or ‘else if’ statement inside another ‘if’ or ‘else if’ statement(s). |
| 4. | switch statement A ‘switch’ statement allows a variable to be tested for equality against a list of values. |
No comments:
Post a Comment