Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ruby loop exercises
# 1. Returns the elements at even positions
# a = [5,6,7,3]
# => [5,7] (5 at index 0, 7 at index 2)
# 2. Calculate the fibonaci at n th (1,1,2,3)
# fibonaci(2) => 1
# fibonaci(4) => 3
# 3. Count how many number 4 in array
# [3,4,5] => 1
# [2,6,7] => 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.