Using Stride in Swift 2.0

It changed a bit, here is the new syntax:

0.stride(to: 10, by: 2)

and

Array(0.stride(to: 10, by: 2)) // is [0, 2, 4, 6, 8]

if you take a look at here, you can see what types conform to the Strideable protocol.

As @RichFox pointed out, in Swift 3.0 the syntax changed back to the original global function form like:

stride(from:0, to: 10, by: 2)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)