class IO def hello_world path = "fileio.txt" writeFile(path, "hello") do |file| file = File.open(path, "a") do write(file, "\nworld") do close(file) do data = read(path) do puts data.last end end end end end end end IO.new.hello_world