Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
basic input program in ruby
# METHODS
def greeting #greeting to the user
puts "\n\n"
puts "Welcome to my first Ruby program."
puts "--" * 25
end
def userName #user identification
puts "Please enter your name:"
name = gets.chomp
puts "hello" + " " + name + " welcome!\n"
return name
end
def userAge(name)
puts "Can you tell me your age?"
age = gets.chomp
puts name
puts "So...#{name} you are #{age} years old.\nNice to meet you."
end
def bye
puts "\n\nWell that is pretty much what i can do so far, so i will just terminate.\n\nGood bye."
end
# RUN
greeting
userAge(userName)
bye
puts "--" * 25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment