writeln wipes contents of variables ?

Chris Wright via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 21 13:59:10 PST 2016


On Thu, 21 Jan 2016 14:07:16 +0000, W.J. wrote:
> So writeln consumes the values in an InputRange. That leads me to
> believe that if I feed an InputRange to foreach, it will consume the
> values, too.
> Did I get that right ?

In general, yes.

Some ranges have value semantics and can be saved simply by assigning 
them to a new variable, or passing them to a function.


More information about the Digitalmars-d-learn mailing list