Easy learning with example program codes

TypeScript control statements tutorial

TypeScript control statement is used to control the flow of program based on the specified condition.

TypeScript control statements:

1. If Statement
2. If else statement
3. if else if statement

TypeScript If Statement:

If statement is used to execute a block of statements if specified condition is true.


 //Block of TypeScript statements. 

TypeScript If Else Statement:

If else statement is used to execute either of two block of statements depends upon the condition. If condition is true then if block will execute otherwise else block will execute.


//Block of TypeScript statements1. 
 //Block of TypeScript statements2. 

TypeScript If Else If Statement:

If else statement is used to execute one block of statements from many depends upon the condition. If condition1 is true then block of statements1 will be executed, else if condition2 is true block of statements2 is executed and so on. If no condition is true, then else block of statements will be executed.


 //Block of TypeScript statements1. 
}else if(condition2){ 
//Block of TypeScript  statements2. 
} . . . else if(conditionn){
 //Block of TypeScript statementsn. 
 //Block of TypeScript statements. 

TypeScript Control Statements Example:

var num:number = 2;  
console.log("TypeScript Statement 1");  
else if(num==2){  
console.log("TypeScript Statement 2");  
else if(num==3){  
console.log("TypeScript Statement 3");  
console.log("TypeScript Statement n");  

Try it:

JS Bin on

TypeScript Tutorial

TypeScript Overview.
Typescript vs Javascript.
Typescript let vs var.
TypeScript Hello World.
Typescript Data Types.
Typescript Variable Declaration.
TypeScript operators list.
TypeScript Arithmetic Operators.
TypeScript Comparison Operators.
TypeScript Bitwise Operators.
Typescript Logical Operators.
TypeScript Assignment Operators.
Typescript Conditional Operator.
Typescript String Operator.
Typescript typeof Operator.
TypeScript control statements.
TypeScript Switch Statement.
TypeScript for loop.
TypeScript for in loop.
TypeScript while loop.
TypeScript do while loop.
Typescript for loop break.
TypeScript for loop continue.
Typescript function.
Typescript returning function.
Typescript parameterized function.
Typescript function optional parameter.
Typescript rest parameters.
Typescript default parameters.
Typescript anonymous function.
Typescript function constructor.
Typescript Arrow/Lambda function.
Typescript function overloading.
TypeScript number object.
TypeScript string object.
TypeScript boolean object.
TypeScript date object.
TypeScript math object.
TypeScript array object.
TypeScript tuples.
TypeScript union type.
TypeScript interface.
TypeScript interface inheritance.
TypeScript interface multiple inheritance.
TypeScript class.
Typescript class inheritance.
Typescript class interface.
TypeScript abstract class.
TypeScript object.
TypeScript duck typing.
TypeScript NameSpace.
TypeScript Multi-file namespaces.
TypeScript module.
TypeScript ambient module.

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki