4 ms·
I really don't understand the complaint about `for` loops... is it just that you can implement the same functionality with a custom-made function? I don't reall
by taco_emoji 10y ago
I really don't understand the complaint about `for` loops... is it just that you can implement the same functionality with a custom-made function? I don't really get what's wrong with the language having some syntactic sugar baked in.
EDIT: should mention I don't know Kotlin so maybe there's something obvious I'm missing...
- nostrademons 10y agoI didn't understand his point either (and I know Kotlin pretty well), but since 1.1 for-loops are basically deprecated in user code and you'd use the forEach method on Iterables: collection.forEach { variable -> .... }
- vbezhenar 10y agoCould you elaborate, why they are deprecated, is there any sources? Actually I'm always wondering which form of "for" I should use and I always using language "for" because, well, it's part of language. I actually think that "for" will be enhanced in the future, e.g. including guards, nested loops, maps, etc, like Scala's version (or Haskell).
- akkartik 10y agoIn general, people complaining about languages really should be showing the results of their examples. Since a lot of programmers are interested in languages, requiring knowledge of a language in such a blog post is hamstringing yourself by restricting your readership. Tell us what the result would be, precisely what line compiles and what throws an error.