A variable is something that holds values or information. The values can be numbers (numeric values), text (strings) or some other kinds of information. These values can vary from time to time, that is why the name variable. It is similar to the post boxes in the post office, the contents of the post boxes can change but the post boxes still have the same name or label. In order to identify the variables, we have to name them.
*Variable names are case-sensitive
There are no hard and fast rules that you must obey in choosing a variable name, but it is best that you choose a name that is meaningful as it makes debugging your program easier.For example, you can use Tel_No for the telephone number, which is better than just using a variable x.
After you have created a variable, you can assign a value to it. The value can be in the form of a number( numeric value), text (String) or boolean (true or false).
var variable_name= value
var mark = 20 var sell_price=100 var age = 40 var height = 180 var temp = 30
var First_Name="George" var car_model = " Laser 100" var Company_Name = ' Ultra Mobile LLC '
Note: The string must be enclosed in quotation marks(either double or single)
var paid = true var alive = false var positive = true
Let's apply what have learned about values assignment in the following example: