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
The only loop shorter than that is an infinite while loop:
while (true) { }
But you would still have to increase a counter and check it in the loop to break the loop, and in the end it wouldn't be shorter.