Iterate Through a File in Nimrod

I like Python’s with open( file, mode ) as f: syntax, but I don’t know how to do something like that in Nimrod. This was the best I could come up with.

let fname = "file.txt"
let fhandle = open( fname, fmRead )

while not fhandle.endOfFile:
    var line = fhandle.readLine()
    echo line

I don’t know what fmRead is exactly, I think it’s a constant? Anyway, it tells the open() function that you’re opening the file to read from it. You’d use fmWrite to write, and say writeLine or something. There’s more documentation in the system module documentation.