RosettaCodeData/Task/Write-entire-file/Wren/write-entire-file.wren
2023-07-01 13:44:08 -04:00

17 lines
335 B
Text

import "io" for File
// create a text file
File.create("hello.txt") { |file|
file.writeBytes("hello")
}
// check it worked
System.print(File.read("hello.txt"))
// overwrite it by 'creating' the file again
File.create("hello.txt") {|file|
file.writeBytes("goodbye")
}
// check it worked
System.print(File.read("hello.txt"))