Created
December 4, 2018 21:23
-
-
Save ventureproz/d8dfb6adcccdc473ac6cdbf03761b039 to your computer and use it in GitHub Desktop.
Ruby Lesson #1
This file contains hidden or 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
puts "what is your first name" | |
first_name = gets.chomp | |
puts "what is your first name" | |
last_name = gets.chomp | |
puts "Your full name is #{first_name} #{last_name}" | |
full_name = first_name + last_name | |
puts "Your full name reversed is #{first_name.reverse!} #{last_name.reverse!}" | |
puts "your name has #{full_name.length} characters in it" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I didn't think of adding the - 1 to the characters length method and came up with the following code below to make that change to show adding the single character in string concatenation first_name + " " + last_name
puts "what is your first name"
first_name = gets.chomp
puts "what is your first name"
last_name = gets.chomp
puts "Your full name is #{first_name} #{last_name}"
full_name = first_name + " " + last_name
puts "Your full name reversed is #{first_name.reverse!} #{last_name.reverse!}"
puts "your name has #{full_name.length - 1} characters in it"