Created
July 17, 2014 10:29
-
-
Save hipertracker/c8adcdf58f10bfd3c194 to your computer and use it in GitHub Desktop.
Problem with extension
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
extension Int { | |
func times(block: () -> ()) { | |
for _ in 0..self { block() } | |
} | |
func times(block: (Int) -> ()) -> Int { | |
for i in 0..self { block(i) } | |
return self | |
} | |
} | |
3.times { println("welcome") } | |
4.times { i in println("by \(i)") } // => Ambigious use of 'times' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
// fix: