write.rb(file)
This Ruby code snippet uses the File.write
method to create a file named ‘filewr.txt’ and write the text ‘Hello’ into it.
Execution:
File.write('filewr.txt', 'Hello')
#=> 5
Executed with Ruby 3.3.6
This Ruby code snippet uses the File.write
method to create a file named ‘filewr.txt’ and write the text ‘Hello’ into it.
File.write('filewr.txt', 'Hello')
#=> 5
Executed with Ruby 3.3.6