On Monday, 17 June 2019 at 00:22:23 UTC, Samir wrote:
Also, if I run the program below with the same file, I don't
get any range violation errors:
Ya, writeln will not access individual elements of a range if
there aren't any. So no violations occur.
HOWEVER, the output is interesting. There IS a blank line
between the last line and the prompt:
That's because you're using write*ln*. So even though line is
empty, you still output a new line.
Any suggestions on how to rectify?
You can do:
if (!line.length) {
continue;
}
Inside your while loop after the call to strip.