We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

matt2xu • 7 years ago

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 :)

[CG]Nick • 7 years ago

Hi,

I think that there are missing comas in code, so it does not compile :/

romainbsl • 7 years ago

Hi,

Thx :)

I just fixed it !

Bubblebenj • 3 years ago

Small typo: few occurences of "lenght" instead of "length"

Anonymous • 4 years ago

hi.
last example have typing error
"aniamls"

Anonymous • 6 years ago

Sealed class snippet code doesn't run!

lestephane1 • 6 years ago

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?

C_Winikka • 6 years ago

I have another: what (if any) is the difference between val and var?

C_Winikka • 6 years ago

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

MadKnight • 7 years ago

a small typo:
> In Kotlin, IF becomes an expression, that means that it cans return values