Last active
April 5, 2016 20:16
-
-
Save cbartlett/b12e61c827ce4c75490a627a6858722c to your computer and use it in GitHub Desktop.
This file contains 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
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) |
This file contains 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
$ 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