3 ms·
It confused me as well. "0.. is less than count"?
by seanwilson 9y ago
It confused me as well. "0.. is less than count"?
- GavinMcG 9y ago".." has a meaning – why are you leaving it out of the translation?
- seanwilson 9y agoI'd usually use ".." in the context of e.g. "2..3" to express a range but "<" to express a condition so I don't find it natural.
- Watabou 9y agoPersonally, I find that just having "0..count" requires a bit of thinking on my part trying to decide if it's inclusive or not. "0..<count" instantly tells me that it's not including value, and follows the matematical interval notification [0..count] vs [0..count)
- seanwilson 9y agoI'd prefer 0..count or 0..(count - 1) then.
- proyb2 9y agoI believe it was discussed in Swift Evolution, not confusing. 0...1 //0 to 1 Note: triple dot. 0..2 //error: repl.swift:1:2: error: use of unresolved operator '..' 0..<1 //0 to <1
- mikeash 9y agoAdd spaces for clarity: 0 ..< count I think Swift programmers should adopt this style.