I assumed the first block of code would work because the following code DOES work:
But those two lines aren’t similar at all, so I’m not sure why the latter would lead you to think the former would work. In the latter line, you are creating an array from a range of Ints; in the first line, you are trying to print the value of an array. Two completely different things.
These lines:
var thisOtherArray: [String] = [" "]
var arrayOfValues = Array(10…19)
do create arrays. (Though note that neither one is an empty array, as they both are created containing values.)
To create an empty String array, you need to use one of these approaches:
var thisOtherArray: [String] = []
var thisOtherArray = Array<String>()
Thank you for this. I noticed that I actually somehow didn’t include the line of code my question was about! (I.e., the line of code in which I first attempted to create an array that, coincidentally, didn’t work anyway).
I believe that your second propoosed line of code was the one that I was trying to remember and mistyped anyway, apparently. Thank you for your help, much appreciated.