Use the ...
notation / operator:
let arr1 = 0...4
That gets you a Range
, which you can easily turn into a “regular” Array
:
let arr2 = Array(0...4)
Use the ...
notation / operator:
let arr1 = 0...4
That gets you a Range
, which you can easily turn into a “regular” Array
:
let arr2 = Array(0...4)