Val
val name = "Sharif"Use val for a variable whose value never changes. You can’t reassign a value to a variable that was declared using val. To make it clear: Imagine your name is ‘Sharif’ and you used val. If you later decide to use your nickname ‘Mia’, you can’t , if you try to change a val, your code won’t actually run at all—the computer will give you an error before it even starts. It’s like a locked door; you can’t even try to put a new name in. Example :-

Var
var age = 25The var keyword means that you can reassign values to age as needed. For example, you can change the value of age from 25 to 26. Example :-

How to visualize val vs var
Think of it like this:
val(Value): Is like writing in Stone. Once it’s carved, you can’t change it.var(Variable): Is like writing on a Whiteboard. You can erase “Sharif” and write “Mia” whenever you want.






