Created
June 3, 2014 12:41
-
-
Save forrestgrant/7badac42f2afc8d75bd1 to your computer and use it in GitHub Desktop.
Swift - RubyMotion
This file contains hidden or 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
numbers = [20, 19, 7, 12] | |
numbers.map { |n| 3 * n } |
This file contains hidden or 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
var numbers = [20, 19, 7, 12] | |
numbers.map({ | |
(n: Int) -> Int in | |
let result = 3 * n | |
return result | |
}) |
Swift has it's good parts too though :) But yes, Ruby love.
I've only seen a WWDC video, but I think you can do:
numbers.map { 3 * $0 }
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lol