Hello and welcome to the golden programming language course in this session.
We want to talk about operators concept.
Go Lang, operators and operator is a symbol that tells the compiler to perform certain actions, does
the functionality of the gold language is incomplete without the use of operators?
Operators allow us to perform different kinds of operations on options in go language.
Operators can be categorized based upon their different functionality or its metric operators, assignment
operators, relational operators, logical operators.
And Bitwise operators, now we are going to talk about operators separated.
Artists, network operators, the artists, music operators are used to perform common arithmetic on
operations such as addition, subtraction, multiplication and etc. following table shows, all the
arithmetic operators supported by Go Language Addition adds to operations subtraction subtracts second
operations from the first multiplication multiply.
Both operations division divides the numerator by the denominator.
Modulus gives the remainder after an integer division increment, it increases the integer value one
by one and decrement.
It decreases the integer value one by one.
Now let's go to your school to get on to display the use of arithmetic operators.
First, go to the Project Explorer and define a folder named like operators and create a fine inside
it like name.
That could set a package name like Package Main and define the main function.
Following may first be defined to variable, such as a column equals 50 and bee colony equals 30.
We want to give an example of an addition, so define the variable life result and poor sum of two area,
both A and B into it.
So define a variable like resolved.
One column equals a plus b addition operator adds two operands in this case addition A and B now write
the following code to display an output.
So we write it if.
Edition
results of a plus B equals per cent D and sit back air and put resolve to reform at the court, save
the project and execute the program, go to a terminal first, go to a project folder, see the operator's
Clearstream and run the program by the comment go round.
Does this mean that go now?
We can see the output addition result of a plus B equals eight.
The sum of two values A and B was added to the result one variable and its value is equal to a T and
they could use from addition operant and other GS subtraction.
Now we want to give an example of a subtraction, so define a variable like resolve to insult like the
two values A and B into it.
So three years the last court.
So define the value of a light resolved to call them equals a minus B cell transaction operator or subtracts
second print from the first or print.
In this case, subtract A and B now write funny and call to display an output.
So we write F f.
Some traction result of a minus B equals person B and C, it resolved to reformat the code, save the
project and execute the program first clear screen and run the command to run dot spec as this may not
go.
Now we can see the outward subtraction, a result of a minus B equals 20.
Subtract the two values A and B into the horizontal variable and its value is equal to 20.
And we could use from subtraction operate another trace multiplication.
Now we want to give an example of a multiplication.
So define a variable like of three and multiplication.
The two one is A and B into it.
So two years the last quote defined a variable like result, three column equals a multiplication,
b multiplication operate or multiplication, two options in this case, multiplication A and B now write
following code to display an output at her.
Multi allegation.
Resolve of a multiple decades, B equals Person D, and is it resolved?
Three.
The format the court saved the project and execute the program.
Now we can see the output multiplication result of A and B equals 1500.
The product of two values A and B was poured into a result three.
And its value is equal to 1500.
And we could use from multiplication, operate another case division.
Now you want to give an example of a division first year the last.
Now define a variable like result for and divide the values A and B by each other and put the result
into it.
So the right result for column equals a Division B go to the next line.
Division D y is the numerator by the denominator.
In this case, Division A and B now write following code to display the output.
So we write that f the division resolved o a and B equals percent d.
And we said resolved for reform at the court, save the project and execute the program.
Now we can see the output division result A and B equals one.
The division of two values A and B was performed into resolve four.
And its value is equal to one.
And we could use from division print another, which is modulus.
Now we want to give an example of modulus.
First, clear, the last code
defined a variable like result fine and divide the values A and B by each other and put the result into
it.
For example, result five column equals a modulus.
B Go to the next line.
Modulus operands gives the reminder after an integer division civil rights following code to display
an output f f modulus
resolved of a person to person B equals person D and you said result func reformat the code, save the
project and execute the program.
Now we can see the output modulus result of A and B equals 20.
The number A was divided by the number B and the reminder was added to the reason five variable and
we could use from Division OFFRANT and other case increments.
Now we want to give an example of an increment.
So first year the last code.
First, define a variable like a calling equals 20
and increment the value of a variable bought before 48, we want to display the variable a FP.
To be four in climate
display and increment a variable increment or plans increases the integer value one by one.
So you write a plus plus and go to the next line and display a again FP after increments and you display
a deformity called Save the Project and execute the program.
Now we can see the output before Increment A is 20 and after Increment A is twenty one, so we could
use for an increment offrent.
Another case decrements.
Now we want to give an example of decree meant first to your last quote,
define a variable like a and initialize it by 20 and display before the agreement it.
And now we want to decrement to a variable decrement or print decreases the integer value one by one.
So we write a minus minus and go to the next line and display a variable again.
If the.
After.
The agreement.
And it is really a here we change it to be for the agreement.
Reformat the code, save the project and execute the program.
Now we can see the output before the climb in the value variable A is 20 and after decrement, the value
of a variable is 90.
And we could use from decrement operand in order not to prolong the time of decision.
We will finish it and we will continue the content in the next session.
Goodbye.