-
-
Save leejarvis/496c2017488be2d1588c to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env ruby | |
def append(array, n) | |
return array if n < 0 | |
append(array, n-1) | |
puts "shit #{n}" | |
end | |
p append([], 3) | |
# | |
append([], 3) #=> print 3 / Runs last | |
-> append([], 2) #=> print 2 / Runs third | |
-> append([], 1) #=> print 1 / Runs second | |
-> append([], 0) #=> return / Runs first |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment