Skip to content

Instantly share code, notes, and snippets.

@edisonywh
Created November 30, 2018 09:18
Show Gist options
  • Save edisonywh/0929c2a22dcce9ee4fc30b32103b64ac to your computer and use it in GitHub Desktop.
Save edisonywh/0929c2a22dcce9ee4fc30b32103b64ac to your computer and use it in GitHub Desktop.
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