In our last article we covered for loops β€” perfect for when you know exactly how many times you need to repeat something. But what happens when you don't know how many times you'll need to loop?

That's where while and repeat loops come in. 🧠

A while loop keeps running as long as a condition is true. The moment the condition becomes false, the loop stops:

while someCondition {

// code to repeat