JanetDocsPlaygroundI'm feeling luckyGitHub sign in
### read a file line by line ### (let [f (file/open "filename.txt")] # bind an open file handle to "f" (while true # loop until "break" is called (let [l (file/read f :line)] # bind a line of the file to "l" (if l (print l) # if l is truthy print l (break)))) # if l is not break from loop (file/close f)) # close the file handle # same as above but using "with" # this means there's no need to # call file/close, also replace # let with var (with [f (file/open "filename.txt")] (while true (var l (file/read f :line)) (if l (print l) (break))))