Half-open Range Operator

Just working through the range examples, and the half-open range operator isn’t working here as expected:

let ticketCount: Int = 1000
let ticketNumbersA = 1 … ticketCount
let ticketNumbersB = 1 …< ticketCount

I expected ticketNumbersB to result in {lowerBound 1, upperBound 999} but it shows up the same as ticketNumbersA with {lowerBound 1, upperBound 1000}.

Am I using the operator incorrectly?

Two dots in the half-open operator, not three.

let ticketNumbersB = 1 ..< ticketCount

… and I see the forum software is turning two dots into 3 if the text isn’t flagged as pre-formatted, so maybe that isn’t your issue.

Yes it must have changed my formatting. In my script I’m using two ..<

You’re using it correctly! The upper bound is the same in either case, the question is whether the upper bound is considered to be included in the range. With a half-open range, the upper bound is not included in the range:

ticketNumbersA.contains(ticketNumbersA.upperBound) // true
ticketNumbersB.contains(ticketNumbersB.upperBound) // false