Skip to content

Instantly share code, notes, and snippets.

@jimmykurian
Created February 6, 2012 17:01
Show Gist options
  • Save jimmykurian/1753322 to your computer and use it in GitHub Desktop.
Save jimmykurian/1753322 to your computer and use it in GitHub Desktop.
Basic File I/O program, written in Ruby.
# FileIO.rb - Jimmy Kurian
print "Please enter a past-tense verb: "
verb = gets.chomp
print "Please enter a noun: "
noun = gets.chomp
print "Please enter a proper noun: "
prop_noun = gets.chomp
print "Please enter a an adverb: "
adv = gets.chomp
print "Please enter a file name: "
fn = gets.chomp
handle = open(fn,"w")
printf(handle, "%s got a %s and\n%s %s around the block.\n",
prop_noun, noun, verb, adv)
handle.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment