Javatpoint Logo
Javatpoint Logo

Decision Making

The programmer uses decision making for specifying one or more conditions to be evaluated by the program. It returns the boolean result true or false.

There are various types of Decision making in TypeScript:

  • if statement
  • if-else statement
  • if-else-if ladder

if statement

The if statement checks the condition and returns true if the given condition is satisfied.

Syntax:

Decision Making

Example:

Output:

a is less than b.

if-else statement

The if-else statement tests the condition. If the condition is true, it executes if block and if the condition is false, it executes the else block.

Syntax:

Decision Making

Example:

Output:

Input value is positive Number: 10

if-else-if statement

The if-else-if ladder statement executes one condition from multiple statements.

Syntax:

Decision Making

Example:

Output:

A+ grade




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA