Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.