Hello and welcome to go down to the Jeromy language course in this session, we want to talk about variable
concept.
Variables variables are like boxes.
Each of each has a specific type, and you can store values to the boxes based of its type.
We might be limited by our programming language, but as shown above, integer float, Boolean and string
are certain the options to be stored in a variable as storing data.
A variable is a place holder of the information, which can be changed and wrong.
Time and variables allow to retrieve and manipulate the stored information in any programming language.
A variable is used to store the data or the value that is used in the program for execution.
The value that is is stored in the variable can be used or modify in the later part of the execution.
For example, a int equals a hundred.
Here a is the variable that is towards the value of 100.
The data type defined is integer, hence a canister only the integer values.
Go variables and go language, a variable holds data temporarily to work with it.
A go line variable declaration needs for things first, a statement that declaring the goal and variable.
Second, a name for the variable.
Toured the type of data it can hold.
And force an initial value for it.
Fortunately, some of the parts are optional, but that also means there is more than one way of defining
a variable in gold.
Go variables include language variables are created in two different.
First, using Varkey Keyboard and go language variables are created using bad keyboard at a particular
time, connected with name and provides its initial value.
Now you can see the syntax that variable name type equals two value.
Second, using short variable declaration, the local variables, which are declared and initialized
in the functions, are declared by using short variable declaration.
Now you can see the syntax variable name column equals value.
Now we want to know some important things about governing variables.
First, Go Lang is a particular type language.
This means that when Golang variables are declared, they either explicitly or implicitly assigned a
type even before your program runs.
Second, Go Lang requires that every variable you declare inside main function get used some very popular
term.
You can assign new value to existing variable, but the value needs to be a same type force.
A variable declared within both branches may be accessed anywhere within the block.
The opening curly braces introduces a new scope that ends with the closing brace.
Either blocks can access variables within out or blocks, but out of block cannot access variables within
inner blocks.
Rules for naming variables.
First, variable names must begin with a letter or an underscore, and the names may contain the letters
a til z lowercase or a P Z uppercase or digits zero till nine, as well as the character underscore.
In this example, we have defined two variables.
Gene is the first variable who is first letter is capital genes.
Second variable in which all letters are lowercase characters and under a scorching 123.
The third variable, who is first letter, begins with an owner, a school and all three variables are
named correctly.
Second and variable name should not to start with a digit.
In this example, we define the variable called a hundred three came, and since the variable is sparse
with the number.
These vary a bit, is not named correctly and is illegal.
Third, the name of the variable is case sensitive.
In this example, you have defined 280 adults in three ways team with lowercase letters and keen that
all the letters are uppercase and queen, who is first letter is uppercase character.
And the naming of all three variable is done correctly.
Fourth, key vote is not allowed to use as a variable name, the GO programming language has a serious
of key wars that cannot be used to define variables such as VAR for extract and search.
Fifth, there is no limit on the length of the name of the variable, but it is advisable to use an
optimum length of 14 15 letters only like first name, last name.
Sixth, the convention go is to use missed caps rather than underscores to ride multi wars names like
the Vote Bear state, where the second part of the vote means debate begins with a capital letter in
order not to prolong the time of decision.
We will finish it and we will continue the content in the next session.
Goodbye.