ReScript supports while loops. While loops execute its body code block while its condition is true.
A mutable binding can control whether a while loop continues.
let shouldStop = ref(false)
while !shouldStop.contents {
if Math.random() > 0.3 {
shouldStop := true
} else {
Console.log("Still running")
}
}