diff --git a/docs/03.reference/01.functions/fileiseof/_examples.md b/docs/03.reference/01.functions/fileiseof/_examples.md index 8bd5a1748..f2fce4fdc 100644 --- a/docs/03.reference/01.functions/fileiseof/_examples.md +++ b/docs/03.reference/01.functions/fileiseof/_examples.md @@ -1 +1,16 @@ -*There are currently no examples for this function.* +```luceescript +filePath = "/path/to/file.txt" +openFile = fileopen(filePath, "read"); +lines = []; +// IMPORTANT: must close file, use try/catch/finally to do so +try { + // fileIsEOF(openFile) == false until we've read in the last line. + while( !fileIsEoF(openFile) ) { + arrayAppend(lines, fileReadLine( openFile )); + } +} catch(any e) { + rethrow; +} finally { + fileClose(openFile); +} +``` \ No newline at end of file