While loops

A while statement repeats a block of instructions as long as a given condition is true.

A while loop generally has three components - the initialization, the condition, and the increment.

Loading TypeScript...

It is important that the condition eventually becomes false, or the program will endlessly repeat the instructions and not do any further work.

Was this page helpful?