3 ms·
If you type var and mean val - would there be any error? (I'm sure that this is just something you need to get used to, I'm merely trying to point out that thi
by darklajid 9y ago
If you type var and mean val - would there be any error?
(I'm sure that this is just something you need to get used to, I'm merely trying to point out that this could be a silent typo/mistake)
- Larrikin 9y agoIn actuality it will be extremely obvious in the IDE and the developer would not make this error.
- thomastjeffery 9y agoif "val" is a constant, and you try to mutate it later, the compiler will tell you, "That ain't gonna happen."
- jpliska 9y agoIn many cases, you would get warnings when accessing a var that you don't get when accessing a val. Also, IntelliJ suggests converting to val if a var is never reassigned.
- dullgiulio 9y agoAs others said, not a problem if you are using an IDE (and a specific one.) Considering who authored the language, I am not surprised at all.