sourcewhile
Sourcewhile is a control-flow construct found in some programming languages and library designs that blends a stream or source of values with looping behavior. In a sourcewhile loop, the next iteration begins by retrieving a value from a source expression, and the loop continues as long as a value is produced and, optionally, an additional predicate on that value holds. The construct is designed for scenarios in which the loop body consumes a sequence of inputs produced by an ongoing source rather than a locally computed condition.
Semantics of sourcewhile are centered on tying each iteration to an input value. On each pass, the
Syntax and variants vary by language but share the same core idea. A common form is sourcewhile
Relation to related constructs includes for-each loops, while loops, and generator-based coroutines. In practice, sourcewhile supports