Hello and welcome to the golden programming language course in the previous session, you talked about
arithmetic operators.
And in this session, we want to talk about the other operators concept.
Assignment operators, assignment operators are used to assigning a value to a variable.
The left side or brand of the assignment operator is a variable and right site or plan of the assignment
operator is the value.
The value on the right side must be of the same data type of the variable on the left side.
Otherwise, the compiler will raise an array of assignment operators and go languages are simple assignment
operator, add and assignment operator.
Subtract and assignment operator.
Multiply and assignment operator.
Divide and assignment operator.
And Modulus and assignment operator.
Now let's go to your school program to illustrate how to use of assignment operators.
First, we define two variables and initialize them.
For example, that a Boyda type eight equals 30 and Vice B by the time gained and equals 15.
Now create the Sampat for simple assignment operator.
Now we will write a equals b.
OK.
A variable value is equivalent be variable value.
Now go to the next line and disbelief values are variable A and B, so the right f be a equals, said
Avery.
Then I go to the next line FP B equals comma B, so reformat the code, save the project and execute
the program.
Go wrong dot.
This list may just go.
Now we can see the output A equals one.
B equals 50, so a variable value is equivalent B variable value.
Now create the same pin for add and assignment operator.
So first, clear the last code.
So we write a plus equals B.
It adds right or end to the left or print and assign a result to left or print.
It means a equals a plus b.
Now we display the value of a variable, so we write FP A equals a.
Save the project and execute the program first, clear screen, go run, dot back as main the school.
Now we can see the output, a variable value is equivalent, the sum of variable A and B, and it is
80 now create a sample for subtract and assignment operator.
So first clear the last court a minus equals B.
It's soft strikes, right or planned from the left or planned and assigned the reason to lift or print,
it means a equals a minus B.
Now we display the value of a variable, so we write up a equals comma, a save the project and execute
the program.
Now we can see the output.
A variable value is equivalent to subtraction of variables A and B, and it's equals minus 20.
Now create a sample for multiply and assignment operator.
So clear the last quote.
A multiplication equals B.
It multiplies right operand with the left operand and assign the result to left footprint.
It means a equals a multiplication.
B Now go to the next line and display the value of a value.
So we write up a equals comma, a save the project and execute the program.
Now we can see the output a equals one thousand and 500, a variable value is equivalent to the multiplication
of variables A and B.
Now you want to create a sample for divide and assignment operator.
So first clear the last code
and we write a divide equals be it divided left operand with the right operation and assign the result
to left operand.
It means eight equals eight.
Division B now go to the next line and display the value of a variable, so we write f b e equals comma
a save the project, then execute the program.
Now we can see the output a equals zero, the value of the variable A is equal to the division of the
value that a buy B and it's zero.
Now, create a sample for modules and assignment operator sofas clear the last got a.
Modulus.
Equals B.
It takes modulus using two operations and assigns the result left operand, and it's means a equals
a modulus b now go to the next line and display the value of a valid and so great FP a equals comma
a.
Reformat the code, save the project and execute the program.
Now we can see the output eight equals 13, the value of variable A is equal to the reminder of the
division of Variable A by B, and it's 30.
OK.
We were able to explain the assignment operators and give examples in order not to prolong the time
of decision.
We will finish it and we'll continue the content in the next session.
Goodbye.