I made a code for a problem that gets its inputs from a file. The inputs are integers and the last line is blank. Below are the ones I’ve tried.
for line in eachline() isempty(strip(line)) && break n = parse(Int, line)
for line in Iterators.takewhile(x -> !isempty(strip(x)), eachline()) n = parse(Int, line)
Are there better alternatives? I like ‘takewhile’ but it’s noticeably slower than the first.