TypeScript Loops

A loop allow to execute one or many statement repeatedly until the condition is satisfied.

    1. for Loop : it will iterate until i<5 condition get failed.

    example code:

      output:

      0
      1
      2
      3
      4

      2. do while:  execute statement and then check for condition. if fails, it will exit the loop.

      example:

      Output:

      1
      2
      3
      4
      5

      3. while : first check and then execute the statement

      Output:

      1
      2
      3
      4
      5

      Leave a Comment

      Your email address will not be published. Required fields are marked *

      Scroll to Top