Created
March 29, 2012 01:54
-
-
Save jumph4x/2232399 to your computer and use it in GitHub Desktop.
I love your feet Ryan
This file contains hidden or 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
GRADES = ['A', 'B', 'C', 'D'] | |
def grade_formula(book_count, reads_books = true) | |
raise "One cannot have read a negative amount of books, you numbnuts." if book_count < 0 | |
index = case book_count | |
when 0..9 | |
3 | |
when 10..20 | |
2 | |
else | |
1 | |
end | |
index -= 1 if reads_books | |
GRADES[index] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment