Skip to content

Instantly share code, notes, and snippets.

@rpdecks
Created April 6, 2020 12:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rpdecks/67f82a7624be25a3f9f29631c36f2488 to your computer and use it in GitHub Desktop.
Save rpdecks/67f82a7624be25a3f9f29631c36f2488 to your computer and use it in GitHub Desktop.
Customer meal waiter lab
#why does this work? explain syntax and logic
def best_tipper
best_tipped_meal = meals.max do |meal_a, meal_b|
meal_a.tip <=> meal_b.tip
end
best_tipped_meal.customer
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment