Repeating with while
Keep going while something is true.
Repeating with while 🔄
Hi, repeat ranger! 🌟 There is another loop called while!
It repeats while a rule is still true. 🪄
let i = 1
while (i <= 3) {
console.log(i)
i++
}While It Is True ✅
while keeps going AS LONG AS the rule is true.
When the rule becomes false, it stops! 🛑
let count = 0
while (count < 3) {
console.log("Loop! 🔁")
count++
}All lessons in this course
- Why We Use Loops
- Counting with a for Loop
- Repeating with while
- Drawing Patterns with Loops