Skip to content

Commit

Permalink
Merge pull request #1421 from MitrahSoft/Added_a_example_06/03/2024
Browse files Browse the repository at this point in the history
Added a example for FileIsEOF() function
  • Loading branch information
zspitzer authored Mar 14, 2024
2 parents ac2137d + 1a34ce2 commit 9f8daf0
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion docs/03.reference/01.functions/fileiseof/_examples.md
Original file line number Diff line number Diff line change
@@ -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);
}
```

0 comments on commit 9f8daf0

Please sign in to comment.