Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jkneedler solution #119

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
21 changes: 18 additions & 3 deletions letsdrill.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
def get_letter_grade(integer)

#Put your code here!
if integer > 89
Copy link

@djlax805 djlax805 May 22, 2020

Choose a reason for hiding this comment

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

On that 90-100 scale eh? 😆 Nice job, in Ruby, you don't need to explicitly return values if the thing you are intending to return is the last line in the method/scope.

Other things to think about when you notice large conditionals are case statements, maybe try to update with one and see how those work and look.

return 'A'
elsif integer > 79
return 'B'
elsif integer > 69
return 'C'
elsif integer > 59
return 'D'
else
return 'F'
end

end

def shortest_string(array)

#Put your code here!
# exclamation mark edits array at same time
array.sort_by!(&:length)
if array.length > 0
return array[0]
else
return nil
end

end

Expand Down