C#C
C#3y ago
__dil__

✅ Introduce variable in `while` condition

Is it possible to achieve something like this? (pseudo-C#)
while (Computation() val when val != otherVal)
  // You can use `val` here...

The idea is that the loop should go until the result of some computation does not match some predicate, and to also keep the result of the computation around in the loop.

If not, how would you achieve a similar pattern?
Was this page helpful?