I have a code that I need to run exactly n times in Swift. What is the shortest possible syntax for that?
n
I am currently using the for loop but
for
There are a lot of answers here, highlighting just how creative you can be, with Swift.
I needed an array so I did this
extension Int { func of(iteration: (Int) -> T) -> [T] { var collection = [T]() for i in 0.. [String] { return 4.of { "\($0) teletubby" } }