Swift is like Kotlin
nilhcem.com
Swift is like Kotlin
1–10 of 364 posts
Re: Swift is like Kotlin
#2Re: Swift is like Kotlin
#30..<count is a lovely little piece of language design
EDIT: Genuinely curious, this is not meant to troll or start a war.
I like the more explicit feeling `count-1`. I'd use either...
Re: Swift is like Kotlin
#40..<count is a lovely little piece of language design
What do you like about it? I was actually thinking the opposite... EDIT: Genuinely curious, this is not meant to troll or start a war. I like the more explicit feeling `count-1`. I'd use either...
Re: Swift is like Kotlin
#50..<count is a lovely little piece of language design
What do you like about it? I was actually thinking the opposite... EDIT: Genuinely curious, this is not meant to troll or start a war. I like the more explicit feeling `count-1`. I'd use either...
When I see "0..<n" I know the range is exclusive of n.
Re: Swift is like Kotlin
#6Re: Swift is like Kotlin
#7 func greet(_ name: String,_ day: String) -> String {
return "Hello \(name), today is \(day)."
}
greet("Bob", "Tuesday")
In me prior experience usually _ denoted an unused parameter/variable.Also: I find the string interpolation syntax ugly... The syntax choices in Swift are curious, but not the most aesthetical/practical in my opinion.
Re: Swift is like Kotlin
#80..<count is a lovely little piece of language design
What do you like about it? I was actually thinking the opposite... EDIT: Genuinely curious, this is not meant to troll or start a war. I like the more explicit feeling `count-1`. I'd use either...
Re: Swift is like Kotlin
#9Earlier quoted context omitted.
What do you like about it? I was actually thinking the opposite... EDIT: Genuinely curious, this is not meant to troll or start a war. I like the more explicit feeling `count-1`. I'd use either...
It confused me as well. "0.. is less than count"?
Re: Swift is like Kotlin
#10Earlier quoted context omitted.
What do you like about it? I was actually thinking the opposite... EDIT: Genuinely curious, this is not meant to troll or start a war. I like the more explicit feeling `count-1`. I'd use either...
When I see "0..n" I wonder whether the range is inclusive or exclusive of n. When I see "0..<n" I know the range is exclusive of n.
Also, exclusivity is almost always what you want, so "0..n" should just default to exclusivity and "0...n" could be inclusive.