Skip to content

Instantly share code, notes, and snippets.

@cbartlett
Last active April 5, 2016 20:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save cbartlett/b12e61c827ce4c75490a627a6858722c to your computer and use it in GitHub Desktop.
def check_grade(grade)
puts "Checking #{grade}"
case grade
when 90..100
puts "A"
when 80...90
puts "B"
else
puts "loser"
end
end
check_grade(60)
check_grade(80)
check_grade(84)
check_grade(90)
check_grade(95.6)
check_grade(100)
check_grade(101)
$ ruby tmp/check.rb
Checking 60
loser
Checking 80
B
Checking 84
B
Checking 90
A
Checking 95.6
A
Checking 100
A
Checking 101
loser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment