While statement
Syntax
while contidion {
// statements
}The code inside while statement will be executed looply until the condition is false.
Counting
var i = 0
while i < 10 {
i++
puts i
}Infinite loop
while true {
// do something
}You can use any true condition, but we recommend boolean value, "true".
Last updated
Was this helpful?