If you want to return a value you will need a return statement. Also it is best practice to avoid an infinite loop to always have an exit condition, preferable at the beginning of the recursive function (early exit strategy).