Created
November 30, 2018 09:18
-
-
Save edisonywh/0929c2a22dcce9ee4fc30b32103b64ac 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
def traverse(tail) | |
head = list.shift # shift takes out the first element | |
puts "Element: #{head}" | |
return if tail.empty? | |
traverse(tail) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment