Skip to content

Instantly share code, notes, and snippets.

@iambowen
Last active December 21, 2015 22:38
Show Gist options
  • Save iambowen/6376181 to your computer and use it in GitHub Desktop.
Save iambowen/6376181 to your computer and use it in GitHub Desktop.
ruby implementation
(1..10).select{|x| x % 2 == 0}.map{|x| puts x / 2}
@zhywang
Copy link

zhywang commented Aug 29, 2013

#!/usr/bin/env irb
[1,2,3,4,5,6,7,8,9,10].select{|x| x%2==0}.map{|x| x/2}

@johnelf
Copy link

johnelf commented Aug 29, 2013

(1..10).select{|x| x % 2 == 0}.map{|x| x / 2}

@XuefengWu
Copy link

(1..10).select{|x| x % 2 == 0}.map{|x| x / 2}.each{|x| puts x}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment