Skip to content

Instantly share code, notes, and snippets.

@cuongld2
Created May 20, 2021 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cuongld2/b346a8e7acd816a7c6dfd6ad39286ad1 to your computer and use it in GitHub Desktop.
Save cuongld2/b346a8e7acd816a7c6dfd6ad39286ad1 to your computer and use it in GitHub Desktop.
get length of array in julia using recursive
function get_length(array)
if array==[]
return 0
end
deleteat!(array, last(array))
return 1 + get_length(array)
end
println(get_length([1,2,3,4]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment