This is the preferred syntax, using the while/do keywords.
These examples show the multiline syntax for Scala 3 while loops.
In all of those examples, i is assumed to be a mutable variable, i.e., defined as a var.
If you wanted to see how to use the Scala 3 while loop syntax, I hope these examples are helpful.
Collection
[
|
...
]