Skip to content

Instantly share code, notes, and snippets.

@mzimecki
Last active March 7, 2017 14:15
Show Gist options
  • Save mzimecki/a0f957871535df5136a04ab67d4761c9 to your computer and use it in GitHub Desktop.
Save mzimecki/a0f957871535df5136a04ab67d4761c9 to your computer and use it in GitHub Desktop.
[Ruby] My first code kata
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