this post was submitted on 19 Jun 2025
27 points (90.9% liked)
Programming Humor
3199 readers
1 users here now
Related Communities [email protected] [email protected] [email protected] [email protected]
Other Programming Communities [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I see your TypeScript and raise you kotlin:
What’s up with that syntax? Why the use of var here?
Kotlin knows mutable and immutable variables.
var
indicate mutables andval
would indicate immutables (comparable with thefinal
modifier in java andconst
in JavaScript/TypeScript).So a var can start as a string and later be an integer?
No, the type is strict and fixed.
I don't know Kotlin but in other languages "(im)mutable" refers to the value, not the type.