Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Write-entire-file/Wren/write-entire-file.wren
Normal file
17
Task/Write-entire-file/Wren/write-entire-file.wren
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
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"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue