It would be the same as you say if you described it out loud:
for i in 0 ..< min(5, products.count) { ... }
However, I suspect that you really mean:
for product in products.prefix(5) { ... }
which is less error prone than anything that requires a subscription.
Perhaps you really need an integer index (although this is rare), in which case you mean:
for (index, product) in products.enumerate().prefix(5) { ... }
Or you can even get a real index if you want:
for (index, product) in zip(products.indices, products).prefix(5) { ... }
source share