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

[CG]Nick • 8 months ago


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

romainbsl • 8 months ago


Thx :)

I just fixed it !

Anonymous • 4 weeks ago

Sealed class snippet code doesn't run!

lestephane1 • 3 months ago

In the infix notation code example i think there is a typo on line 5
should be
println(1 add 1)
should it not?

C_Winikka • 5 months ago

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

C_Winikka • 5 months 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 months ago

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

matt2xu • 7 months 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 :)