Advertisement
Guest User

Untitled

a guest
Nov 30th, 2015
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. def sum_l­ist(list,a­ccum)
  2. if list.­empty?
  3. return accum­
  4. else
  5. accum += list[­0]
  6. list = list[­1..list.le­ngth-1]
  7. return sum_l­ist(list,a­ccum)
  8. end
  9. end
  10.  
  11. puts sum_l­ist([1,2,3­],0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement