Possible use of ... operator?


#1

In the “Enumerations and the Switch Statement” section of this chapter, it says:

Switch statements can match on many types, even ranges:

let macOSVersion: Int = ...
switch macOSVersion {
case 0...8:
    print("A big cat")
case 9:
    print("Mavericks")
case 10:
    print("Yosemite")
case 11:
    print("El Capitan")
case 12:
    print("Sierra")
default:
    print("Greetings, people of the future! What's new in 10.\(macOSVersion)?")
}

Does anyone know what is meant by assigning “…” to the macOSVersion constant? I can’t seem to find an explanation of this. It almost seems like its a range operator with values left off both ends of the range, but I can’t find any mention in Swift documentation of such an operator or its usage. Could this possibly be a typo?


#2

"..." probably means: enter a value for the OS version.

let macOSVersion: Int = 8

#3

Ah, okay that makes a lot more sense. It just didn’t seem obvious from the text. Thanks, Ibex!