simple-exercises/ruby-exercises/easy-1.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.
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.
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 .
def nearby_az string
  (0...string.length).each do |i|
    if string[i] == "a"
      if string[(i + 1)..(i + 3)].include?("z")
        return true
      end
    end
  end
  false
end
def nearby_az string ( 0 ... string . length ) . each do | i | if string [ i ] == "a" if string [ ( i + 1 ) .. ( i + 3 ) ] . include? ( "z" ) return true end end end 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 " .
string
<not_specific>