Local Variables: The name of a local variable must begin with a lowercase letter (a-z) or an underscore ( ). These variables are only available inside the scope of the code construct in which they are declared. A local variable can only be accessed within the initialization section. Outside of the method, local variables are not accessible.
The range of a variable is defined by its scope. A local variable's scope is limited to that method; that is, once we establish a variable within a method, it cannot be accessed outside of that function.
A variable in programming that is only used within the routine or function in which it is defined. The local variables are no longer present when the function is completed and control is restored to the part of the program that called it.
Local variables are a sort of variable that may only be retrieved within the function that defines them and are only available within the context of a certain expression. When you just require data within a single expression, local variables come in handy.
Share a personalized message with your friends.