Recursion: Length of a String

Published by Bjarte in

Write a function that returns the length of a string. Make your function recursive.

Examples

Length("apple") ➞ 5

Length("make") ➞ 4

Length("a") ➞ 1

Length("") ➞ 0

Notes

Check the Resources tab for info on recursion.

Watch a quick demo on how Edabit works.