On Mon, 24 Nov 2014 19:04:34 +0000 Suliman via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:
> I can't understand why foreach loop produce every line by line, > while it's fuctional analog print lines on one string: the two samples are not the same, they doing completely different things. File.byLine returns *output* *range*. what `foreach` does is processing this range element by element, while `writeln(range)` outputs the whole range. the second code means: auto lines = file.byLine(); writeln(lines); for `writeln` output range is a kind of array, so it outputs it as an array.
signature.asc
Description: PGP signature