I hope you enjoyed my last 3 lessons.
I didn't hear questions from you yet.
I don't think that everything 100% understood in my lessons.
so, Where are the questions?
I hope to hear you soon.
Download this lesson & Enjoy it.
I want to ask about arithmetical operators.
1. It is written the following:
A = B + C, with description that add A to B and assign the result to C.
Is it mistake?
The same with A = B - C.
2. And I do not understand A = A % C, with description: A is remider of division of B on C(ex: 10%2 will produce 0).
I simple do not understand 10 % 2 = 0 and 10 % 3 = 1.
May you explain? :confused:
3. It was mentioned that we can not write as:
we must write: :confused:
May be the following:
And the other 3 questions.
1. May you explain
A %= B;
Because I do not understand A = A % B
A >>= B
A is greater or equal B ?
3. A += B
it is A = A + B
Ok. Now I understand.
We can not use our simple arithmetical knowledge.
A += B
is the A increasing on B.
A -= B
is A decreasing on B.
A = B%C
is the remainder from dividing B by C.
And I think A /= B
A = A / B.
And A = A + B
is valid because it is not arithmetic.
It is logic.
A = A + B; // --> A = 12 +6;
It is arithmetical operations but it is logic.
In arithmetic if
A + B so it should be C already.
It should not be the same A (the same value).
Because if we are increasing A on B assigning the result to A so
A will be increasing on B all the time. Every second A will be increasing on B without any stopping. It means A plus B is equal A (the same A?) so plus B once again (because of A plus B) is equal A (an other A) which should be added to B and so on.
May be during the coding everything will be clear.
But I have a question.
In Relational operators A == Bi;
It means true if A equal B else false.
Is it necessary to have i after B?
"A" is only the variable where we store value.
A = A + B; means that we want to modify the value stored in A ... with a new value (A+B).
Of course after executing that struction ... A will have new value.
i After B is not needed and would be an error.