HiddenLayer555@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 12 days agoWhy make it complicated?lemmy.mlexternal-linkmessage-square20fedilinkarrow-up11arrow-down10file-text
arrow-up11arrow-down1external-linkWhy make it complicated?lemmy.mlHiddenLayer555@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 12 days agomessage-square20fedilinkfile-text
minus-squareByteWelder@feddit.nllinkfedilinkEnglisharrow-up0·11 days agoIn Kotlin, you can have the type become implicit with the former syntax: let text = number.toString() (text is a String here)
minus-square𝕱𝖎𝖗𝖊𝖜𝖎𝖙𝖈𝖍@lemmy.worldlinkfedilinkarrow-up0·edit-210 days agoYou can also do that in TypeScript readonly a!: Foo; readonly b = bar.toFoo(); constructor(){ a = bar.toFoo(); }
In Kotlin, you can have the type become implicit with the former syntax:
let text = number.toString()
(text
is aString
here)You can also do that in TypeScript
readonly a!: Foo; readonly b = bar.toFoo(); constructor(){ a = bar.toFoo(); }