3 ms·
A single ':' is used for other things, like casting types. let x: int = 0; It's so that the compiler can distinguish between those two, and likely some ot
by torresjrjr 4y ago
A single ':' is used for other things, like casting types.
let x: int = 0;
It's so that the compiler can distinguish between those two, and likely some other areas too.
- xigoi 4y agoA different character could be used, such as # (like in VimScript) or \ (like in… PHP?)
- torresjrjr 4y agoTrue, but :: is probably more readable than # or \ Design a language, and you'll understand that there's always trade-offs.
- xigoi 4y agoI personally find :: very unreadable, for the very reason I mentioned.