Use of loops – “while”

Use of loops -

is about while loop. This loop executed if the condition is TRUE, when the condition is false the loop ends.

The general syntax of this loop is the next:

while (TRUE) {

  //group of statements...

}

A common mistake is put a “;” at the end of the condition. DO NOT put a “;” it could cause a error.

 

As always I leave a example for each mastery, so here it is! of couse in my GitHub.

CC BY 4.0 Use of loops – “while” by Gonzalo Mata is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.