practice-problems-1/comments/07-most-letters.rb
# Write a method that takes a string in and returns true if the letter
# "z" appears within three letters **after** an "a". You may assume
# that the string contains only lowercase letters.
#
# Difficulty: medium.
Write a method that takes a string in and returns true if the letter
"z" appears within three letters **after** an "a". You may assume
that the string contains only lowercase letters.

medium.
Write a method that takes a string in and returns true if the letter " z " appears within three letters ** after ** an " a " . You may assume that the string contains only lowercase letters . medium .
def nearby_az(string)
    for i in string.split('')                                   
        if i == "a" && string[i.to_i..3].include?('z')          
            return true
        end
        if i == 'z' && string[i.to_i..3].include?('a')          
            return false
        end
    end
    return false            
end
def nearby_az ( string ) for i in string . split ( '' ) if i == "a" && string [ i . to_i .. 3 ] . include? ( 'z' ) return true end if i == 'z' && string [ i . to_i .. 3 ] . include? ( 'a' ) return false end end return false end
Write a method that takes a string in and returns true if the letter
"z" appears within three letters **after** an "a".
Write a method that takes a string in and returns true if the letter " z " appears within three letters ** after ** an " a " .
#loop through letter in string #if the current iteration is 'a' AND the next 3 letters include 'z'  #if the current iteration is 'z' AND the next 3 letters include 'a'  #both condition fail, the fails
string
<not_specific>