Ranges
a...b is closed and a..<b is half open. Ranges can slice collections.
Example
let r = 1...5
print(r.contains(3), Array(r))
let a = [10, 20, 30, 40]
print(a[1...2], a[..<2], a[2...])Exercise
Half open.
03
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.