“Write a method count_a(word) that takes in a string word and returns the number of a’s in the word. The method should count both lowercase (a) and uppercase (A)”
def count_a(word)
a_count = 0
i = 0
while i < word.length
char = word[i]
if char == "a" || char == "A"
a_count += 1
end # if - **am I right?**
i += 1
end # while - **am I right?**
return a_count
end # count - am I right?
puts count_a(“application”) # => 2
puts count_a(“bike”) # => 0
puts count_a(“Arthur”) # => 1
puts count_a(“Aardvark”) # => 3