Ruby Quick Reference

Quick reference for efficient coding

View the Project on GitHub YumaYX/RubyQuickReference

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.5