Help counting how many "e" appear in an array of strings
I am trying to figure out how to refine this code to make it count how many of the letter "e" appears throughout an array. The way the code is right now, it will count the number of "e" and add it the the counter IF there is only one string in (word). I can not figure out how to keep my loop iterating over word.length and also iterating through the length of the individual string while checking each index for a == "e". Any help would be greatly appreciated. Basically i want to count all of the "e" that appear in the method calls and return the total count def count_e(word) count = 0 i = 0 while i < word.length char = word[i] if char == "e" count += 1 end i += 1 end return count end puts count_e("movie", "electricity") # => 3 puts count_e("excellent", "elf", "elephant") # => 6