For example, in python I could say something along the lines of
arr = range(0,30)
and get an array with said elements. I suspect that something similar might be possible with a subscript in Swift, but after scouring the documentation and Apple's iBook I can't find a "batteries-included" solution for generating said array.
Is this something I'd have to write the code manually for, or is there a pre-written method for it?
You can create an array with a range like this:
var values = Array(0...100)
This give you an array of [0, ..., 100]
[0, ..., 100]
2.1m questions
2.1m answers
60 comments
57.0k users