CeasarChiper, Sample Solution code explanation or understanding?

Hello, first of all, loved this exercise. but I couldn’t’ figure out the, the for in loop, out and had to reference the solution code. Solution Code,

I am looking for an explanation of the 2 dots and less than, are used in the for in loop. “…<” at lines 10 & 12 (follow Git link) or cut and pasted code below.

Thanks for any tips or help understanding that.

Hope my question makes sense.

Thanks🙏

for i in 0 ..< message.count {
  
  for j in 0 ..< alphabet.count {
    
    if message[i] == alphabet[j] {
        
      message[i] = alphabet[(j+3) % 26]
      break
      
1 Like

See the section on “Half-Open Range Operator”

https://docs.swift.org/swift-book/LanguageGuide/BasicOperators.html#ID73

// 1...4 will iterate over numbers 1, 2, 3, 4 (final value included)
// 1..<4 will iterate over numbers 1, 2, 3 (final value excluded)

// For other variations of range operators such as one-sided ranges, 
// see link above (section Range Operators)
1 Like

:pray:Thanks very much!! Much to learn.