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
You could do something like this:
10⨉{ print("loop") }
Using a custom operator and an extension on Int:
Int
infix operator ⨉ // multiplication sign, not lowercase 'x' extension Int { static func ⨉( count:Int, block: () ->Void ) { (0..