0

One-Sided Range, Swift Programming

Hi, I'm a little confused to what this means and the example. I've read: - it CAN NOT iterate over a one-sided range that OMITS a FIRST value and the example it gives is: (I don't think the example it gives is to prove the above notation) let range = ...5 range.contains(9) (false) range.contains(3) (true) range.contains(-1) (true) I guess, what does it mean when they are saying, "OMITS A FIRST VALUE"? I understand that it wouldn't know where to start from but how is it omitted? Thanks!

9th Jun 2020, 4:44 PM
Julius
2 Antworten
+ 2
This will explain ranges fairly well, including one-sided ranges. If after reading and experimenting you have any further questions, feel free to ask. https://www.programiz.com/swift-programming/ranges#:~:text=In%20this%20article%2C%20you%20will,sequential%20from%200%20to%209. try using; let range = ..<6
9th Jun 2020, 5:19 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Thanks ChaoticDawg!
10th Jun 2020, 5:30 PM
Julius