Skip to content

Instantly share code, notes, and snippets.

@iartarisi
Last active September 27, 2016 15:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iartarisi/6608341 to your computer and use it in GitHub Desktop.
Save iartarisi/6608341 to your computer and use it in GitHub Desktop.
if-let in ruby?
(if-let [found (first (filter #(true? ("good" %))))]
  (.do_something found)
if found = myarray.detect {|x| x['good'] == true }
  found.do_something
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment