These wrappers for assert and require allow you to execute a block of code conditionally:
These methods generate lists using while and do...while loops, similar to the for comprehension.
These methods generate lists using while and do...while loops, similar to the for comprehension.
Thus, you can do:
val result1: List[String] = do
{ g() } while
(f() < 5)
val result2: List[String] = while
(f() < 5) { g() }
These wrappers for assert and require allow you to execute a block of code conditionally:
val result = withRequire(input == "valid") { foo(input) }