Thus, variables declared using let minimize the possibilities of runtime errors, as the compiler give compile-time errors. This increases the code readability and maintainability. Const. Variables can be declared using const similar to var or let declarations. The const makes a variable a constant where its value cannot be changed. When you call the method, the method ofcourse runs. val defines a value (an immutable variable). The assignment expression is evaluated when the value is initialized. lazy val defines a value with delayed initialization. It will be initialized when it's first used, so the assignment expression will be evaluated then. Both val and var are used to declare variables. var is like general variable and it's known as a mutable variable in Kotlin and can be assigned multiple times. val is like final variable and it's known as immutable in Kotlin and can be initialized only single time. In this video, we'll dive into the world of Kotlin variables and explore the difference between Var and Val. You'll learn the basics of variable declaration, Then let y = x defines a variable y, and initializes y with the reference stored in x variable. This is a pass by reference. y.push(2) mutates the array by pushing an item 2. Because x and y variables reference the same array, this change is reflected in both variables. Note: for simplicity, I say that variables hold references to objects. Show activity on this post. .val () is used to get/replace input elements values in jQuery, alternative in JS is .value. innerHTML or jQuery's .html () is used to get/replace the whole markup inside an element, not input elements. text () is used almost the same as JS innertHTML, only it gets/replaces the text inside an element, not all the uichLZB.