HiddenLayer555@lemmy.ml to Programming Humor@lemmy.worldEnglish · 5 months agoWhy make it complicated?lemmy.mlimagemessage-square12linkfedilinkarrow-up130arrow-down13file-textcross-posted to: [email protected]
arrow-up127arrow-down1imageWhy make it complicated?lemmy.mlHiddenLayer555@lemmy.ml to Programming Humor@lemmy.worldEnglish · 5 months agomessage-square12linkfedilinkfile-textcross-posted to: [email protected]
minus-squaremacniel@feddit.orglinkfedilinkEnglisharrow-up5·5 months agoI see your TypeScript and raise you kotlin: var a: String
minus-squarebranch@lemmy.worldlinkfedilinkEnglisharrow-up1·5 months agoWhat’s up with that syntax? Why the use of var here?
minus-squaremacniel@feddit.orglinkfedilinkEnglisharrow-up3·edit-25 months agoKotlin knows mutable and immutable variables. var indicate mutables and val would indicate immutables (comparable with the final modifier in java and const in JavaScript/TypeScript).
minus-squarebranch@lemmy.worldlinkfedilinkEnglisharrow-up1·5 months agoSo a var can start as a string and later be an integer?
minus-squaremacniel@feddit.orglinkfedilinkEnglisharrow-up2·5 months agoNo, the type is strict and fixed.
I see your TypeScript and raise you kotlin:
var a: StringWhat’s up with that syntax? Why the use of var here?
Kotlin knows mutable and immutable variables.
varindicate mutables andvalwould indicate immutables (comparable with thefinalmodifier in java andconstin JavaScript/TypeScript).So a var can start as a string and later be an integer?
No, the type is strict and fixed.
deleted by creator