Guest User

Untitled

a guest
Aug 14th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. def wow(arr,i)
  2. if i == 0
  3. return(arr[i].even? ? arr[i] : 0)
  4. else
  5. return(arr[i].even? ? arr[i]+wow(arr,i-1) : wow(arr,i-1))
  6. end
  7. end
  8. a = [1,2,3,4,5,6,7]
  9. print wow(a,a.length-1)
Add Comment
Please, Sign In to add comment