Skip to content

Instantly share code, notes, and snippets.

@benolee
Created September 29, 2010 18:28
Show Gist options
  • Save benolee/603255 to your computer and use it in GitHub Desktop.
Save benolee/603255 to your computer and use it in GitHub Desktop.
# This computes the sum of the integers from a through b:
def sum_integers(a,b)
return 0 if a > b
a + sum_integers((a+1), b)
end
puts sum_integers(1,10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment