2. The name2 = "bbbb" variable will be only local to a method names. names will be visible after you set it and to the end of your names method. But using the self.name1 = "aaaa" you will add an attribute to your class instance self, which will be known to other methods of your self instance. So use self.xyz for any data you have to store in The following table briefs the difference between let and var and const in javascript: var. let. const. var has the function or global scope. let's have the block scope. const variable has the block scope. It gets hoisted to the top of its scope and initialized undefined. The main difference between let and var is that scope of a variable defined with let is limited to the block in which it is declared while variable declared with var has the global scope. So we can say that var is rather a keyword which defines a variable globally regardless of block scope. The scope of let not only limited to the block in The let variables have the same execution phase as the var variables. The temporal dead zone starts from the block until the let variable declaration is processed. In other words, it is the location where you cannot access the let variables before they are defined. In this tutorial, you have learned about the differences between var and let Add a comment. 1. properties and parameters are different thinks: parameters : when we declare any function : fun sum (a: Int, b: Int): Int { return a + b } Function having two Int parameters with Int return type: Properties and Fields: Declaring Properties. Classes in Kotlin can have properties. This is an excerpt from my book on Functional Programming in Scala.It’s an appendix that “explains and explores” Scala’s function syntax. Background. I wrote in the “Functions are Values” lesson that most developers prefer to use the def syntax to define methods — as opposed to writing functions using val — because they find the method syntax easier to read than the function The Difference Between let and var in JavaScript. In JavaScript, you can use let or var to declare mutable variables. A variable with the let keyword will only be used within the block it is declared and not affect variables used in nested blocks, like if statements and for loops, or outside the block. Below is an example: The other option is var. Integer types store whole numbers, positive or negative (such as 123 or -456), without decimals. Valid types are Byte, Short, Int and Long. Floating point types represent numbers with a fractional part, containing one or more decimals. There are two types: Float and Double. If you don't specify the type for a numeric variable, it is most often .

difference between var and val