Last active
March 7, 2017 14:15
-
-
Save mzimecki/a0f957871535df5136a04ab67d4761c9 to your computer and use it in GitHub Desktop.
[Ruby] My first code kata
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_needle(haystack) | |
haystack.each_with_index do |elem, i| | |
if elem.to_s.eql?(‘needle’) | |
return “found the needle at position #{i}” | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment