Skip to content

Instantly share code, notes, and snippets.

@elreimundo
Last active December 19, 2015 13:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elreimundo/5960706 to your computer and use it in GitHub Desktop.
Save elreimundo/5960706 to your computer and use it in GitHub Desktop.
Am I cheating? When I taught Geometry, I used to teach my kids that this was the only requirement for a (planar) triangle. I feel like I should be teaching the machine to check for isosceles, equilateral, etc., but if all we want is to determine if a triangle is valid...
def valid_triangle?(a, b, c)
(a + b > c) && (a + c > b) && (b + c > a)
end
@elreimundo
Copy link
Author

Got rid of that pesky return. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment