-
Notifications
You must be signed in to change notification settings - Fork 0
os.read_lines
madra.net edited this page Mar 15, 2020
·
1 revision
read_lines(path string) ?[]string
Read file into array of lines. Result is optional so handle possibility of error. Resulting array can be iterated over with for … in …
loop:
Example:
lines := os.read_lines("/path/to/somefile.txt") or { panic(err) }
// loop print each line
mut i := 0
for line in lines
{
println('[$i] $line')
i++
}