Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def sum_list(list,accum)
- if list.empty?
- return accum
- else
- accum += list[0]
- list = list[1..list.length-1]
- return sum_list(list,accum)
- end
- end
- puts sum_list([1,2,3],0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement