Hello! This is about using loops with while, as we saw on the past mastery about using loops with for, Loops are used to repeat a group code as many times as wanted. They finish in small and simple parts a complex process by repeating itself

 

How do you type a loop using while?

 

A basic while structure using a loop is…

 

while (condition){

code to do if the condition is true}

 

While has many conditions which can be used but compared to the “for loop”, while has to have a condition.

 

Do while- these are useful for things that want to loop at least once. The structure is very simple.

CC BY 4.0 #Mastery19 – Use of loops with “while” by Ricardo Newton is licensed under a Creative Commons Attribution 4.0 International License.