We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
Hi,
I think that there are missing comas in code, so it does not compile :/
Hi,
Thx :)
I just fixed it !
Small typo: few occurences of "lenght" instead of "length"
hi.
last example have typing error
"aniamls"
Sealed class snippet code doesn't run!
In the infix notation code example i think there is a typo on line 5
println(1.add(1))
should be
println(1 add 1)
should it not?
I have another: what (if any) is the difference between val and var?
Three things:
1. Thanks. This page kept me busy awhile just pondering the nuances of Kotlin at a glance.
2. Is a list mutable? In other words, can you change animals at index position 0 to a different animal without causing an error? For example, in Python lists are mutable, so you can change an item by accessing it's index position. For example, in Python,
animals[0] = "weasel"
changes the first item in animals from "dog" to "weasel." I tried it that way in Kotlin above, but it ran an error. That seems to suggest it's immutable, but it could just be that my syntax doesn't work in Kotlin, and there's some kind of list method that lets us do just that.
3. There were a few typos: aniamls instead of animals and convinient instead of convenient
a small typo:
> In Kotlin, IF becomes an expression, that means that it cans return values
Just a small typo: the withIndex() example seems to be backwards, for me it prints "animal at dog is 0" etc when I expected it to be the other way around (animal at 0 is dog). Otherwise it's nice to see an overview of Kotlin like this :)