TypeScript while loop

The while loop repeatedly executes a block of statements until a particular condition is true. It first check the condition and executes a block of statements if condition is true.

Syntax:

while(condition){
 //Block of statements 
}

TypeScript while loop example:

var num:number=1;  
while (num<=10)  {  
console.log(num);
num++;
}  

 

Please follow and like us:
Content Protection by DMCA.com