Skip to content

Instantly share code, notes, and snippets.

@stevencombs
Created October 13, 2013 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevencombs/6963768 to your computer and use it in GitHub Desktop.
Save stevencombs/6963768 to your computer and use it in GitHub Desktop.
Input, output and text manipulation in Ruby
# Ruby Getting Started with Programming
# A Codecademy Ruby (Putting the Form in Formatter) assignment
# Dr. Steven B. Combs, coding novice
# gets requests user input and the .chomp modifier excludes new/blank line that ruby includes by default
#request input
print "What's your first name?"
first_name = gets.chomp.capitalize! # Replaces first_name variable with first character capitalized version
print "What's your last name?"
last_name = gets.chomp.capitalize!
print "What's your city?"
city = gets.chomp.capitalize!
print "What's the two character code of your state?"
state = gets.chomp.upcase! # Replaces state variable with all caps version
# Log variables to the console
puts "#{first_name} #{last_name} lives in #{city}, #{state}."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment