File size: Difference between revisions

Add lang example
m (OCaml: update links)
(Add lang example)
Line 927:
println("Length of $path is ${File(path).length()} bytes")
}</syntaxhighlight>
 
=={{header|Lang}}==
Currently this task is only possible by using Standard Lang and the Lang IO Module.
<syntaxhighlight lang="lang">
# Load the IO module
# Replace "<pathToIO.lm>" with the location where the io.lm lang module was installed to without "<" and ">"
ln.loadModule(<pathToIO.lm>)
 
$file1 = [[io]]::fp.openFile(input.txt)
fn.println([[io]]::fp.getSize($file1))
[[io]]::fp.closeFile($file1) # Remember to close files
 
$file2 = [[io]]::fp.openFile(/input.txt)
fn.println([[io]]::fp.getSize($file2))
[[io]]::fp.closeFile($file2)
</syntaxhighlight>
 
=={{header|Lasso}}==
168

edits