Created
October 13, 2013 15:50
-
-
Save stevencombs/6963768 to your computer and use it in GitHub Desktop.
Input, output and text manipulation in Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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