Skip to the content.

read.rb(file)

This Ruby code uses the File.read method to read the contents of a file named ‘filewr.txt’ and returns the content as a string.

Execution:

File.read('filewr.txt')
#=> "Hello"

Executed with Ruby 3.3.6