Ruby noob. Trying to build a hangman game and use the following code to find the index so I can replace the dashes with the guessed letter when a players guesses correctly. The words are from a json database. @letter and @word are added here as an example, and instance variables are used because I'm def methods in the full code.
Any ideas why this is not working? Can 'find_index' return multiple values for every place it finds the letter? If 'find_index' doesn't return multiple values is there an array method which does?
@word = "elephant"
@letter = "e"
@word = @word.split
@index = @word.find_index(@letter)
puts "the index is #{@index}"