When str[0] is "a" and str[4] is "b" I get true. However, when "a" is in another position and is separated by three spaces from "b" I get false.
Any help would be great!
def ABCheck(str)
str.downcase.split()
x = 0
while x < str.length - 4
return true if ((str[x] == "a") && (str[x + 4] =="b"))
x += 1
return false
end
end
puts ABCheck("azzzb")
#Currently puts "true"
puts ABCheck("bzzabzcb")
#Currently puts "false" - even though it should print true