loop
The loop statement is used to execute a block of code indefinitely.
let x = 0
loop {
Transmission { %(x) }
x += 1
if x >= 5 {
break
}
}
Returning Values
When loop is used in an expression, the break statement determines the resulting value of the expression.
let a = loop {
if Tick > 10s {
break 100
}
await Tick
}
// a is now `100`