Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion beer.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@


def age_function(age)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tli-ga nice commit message haha

#write a function that accepts a variable: age
if age > 21
puts("Yay, have a beer!")
else
puts("Nay, don't have a beer!")
end
end
#if age is greater than 21, display "Yay, have a beer!"
#otherwise show them a message: "Nay, don't have a beer!"

puts("What is your age?")
#ask for the user's age

user_age = gets.chomp.to_i
#store the user input in a variable: user_age

age_function(user_age)
#run the function with the user_age variable