Skip to content

Instantly share code, notes, and snippets.

@PirosB3
Created April 9, 2013 19:43
Show Gist options
  • Save PirosB3/5348736 to your computer and use it in GitHub Desktop.
Save PirosB3/5348736 to your computer and use it in GitHub Desktop.
def show_sentence(sentence)
file_name = "#{sentence}.txt"
# In this case, File.open statement returns the same contents returned from the block
File.open(file_name,"r") do |file|
# this inner block is returning the response from file.read()
file.read()
end
end
puts "Sentence is: " + show_sentence('lol')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment