# while loop The while loop loops through a block of code as long as a specified condition is true. ## Syntax ``` while(condition) { // your code } ``` ## example ``` let i = 0; while(i < 10) { console.log('the value of i = ',i); i++; } ``` ## output ``` The value of i = 0 The value of i = 1 The value of i = 2 The value of i = 3 The value of i = 4 The value of i = 5 The value of i = 6 The value of i = 7 The value of i = 8 The value of i = 9 ``` At i = 10 condition becomes false and while loop terminates.