Let's say I have something like this:
var x : String = "str"
// here do some with x, but not assign new value to it
Then Android Studio tells me that x should be declared with val
, not var
.
I know what's the difference between var
and val
.
If I don't need to assign value to x
it could be val
.
But does it make any difference at runtime?
When I declare variable with val
instead of var
, is it somehow faster?
This is not duplicate! I am asking about performance, not about difference in meaning.