I'm trying to iterate through the vowels "aeiou" and move every letter forward, returning the string "eioua". This is my code:
def vowel(letter)
vowels = "aeiou"
string = ""
index = 0
while index < letter.length
current_id = vowels.index(letter)
next_vowel = vowels[current_id + 1]
string += next_vowel
index += 1
end
string
end
When I pass "aeiou" as a parameter to my method, it just takes "a", and prints "eeeee".
vowel("aeiou") # => "eeeee"