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: 11 additions & 0 deletions beer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,20 @@
#write a function that accepts a variable: age
#if age is greater than 21, display "Yay, have a beer!"
#otherwise show them a message: "Nay, don't have a beer!"
def function_one(age_one)
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.

think about naming functions something descriptive


if age_one >= 21
puts("Yay, have a beer!")
else
puts("Nay, don't have a beer!")
end
end

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

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

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