ReScript supports while
loops. While loops execute its body code block while its condition is true.
ReScript does not have the break
keyword, but you can easily break out of a while loop by using a mutable binding.
let break = ref(false)
while !break.contents {
if Math.random() > 0.3 {
break := true
} else {
Console.log("Still running")
}
}