python:
a: str = 1
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
I've always wondered where all this 'let' business started
It's commonly used in math to declare variables so I assume programming languages borrowed it from there.
BASIC uses (used?) it to declare variables. (I don't know if earlier languages did.)
Not that that's a reason for other languages to copy it.
You're encoding more information in the typescript one. You're saying it's a string that will get updated.
You aren't though. In most languages that use the latter declaration you would prefix the declaration with final or const or the like to specify it won't be updated.
Yeah, it's explicitly distinct from const a: String
which says it won't change, and var a: String
, which means this is legacy code that needs fixing.