3 ms·
What's the point of the 'val' keyword? It reminds me of Visual Basic's "Dim x As String".
by dirtydroog 6y ago
What's the point of the 'val' keyword? It reminds me of Visual Basic's "Dim x As String".
- RhodesianHunter 6y agoval is immutable, var is mutable
- saagarjha 6y agoImmutable, as opposed to var which declares a mutable variable.
- djur 6y agoHaving a keyword for variable initialization makes parsing easier and less ambiguous. "let", "var", etc. are also used for this purpose, but I was going along with the example.