Skip to content

FileHandle.close

JoeStrout edited this page Nov 16, 2026 · 5 revisions

Close the file handle, writing any changes to the disk. Closing a handle that is already closed does nothing.

Parameters

None.

Return value

None.

Notes

An open file is worked on in memory; this is the point at which changes reach the disk. A handle that is never closed never persists what was written to it.

Closing a handle that is already closed does nothing. Every other method (except isOpen) returns an error on a closed handle.

Example

import "file"
fh = file.open("data.txt", "r")
if not (fh isa error) then
    print fh.readLine
    fh.close
end if

Clone this wiki locally