Read a file line by line
FileHandle.each{} is lazy, allowing us to do this:
File(__FILE__).open_r.each { |line|
say line
}
Same thing explicitly:
var fh = File(__FILE__).open_r
while (fh.readline(\var line)) {
say line
}
FileHandle.each{} is lazy, allowing us to do this:
File(__FILE__).open_r.each { |line|
say line
}
Same thing explicitly:
var fh = File(__FILE__).open_r
while (fh.readline(\var line)) {
say line
}