Reputation: 159
Can anybody tell me what this operation in the Arduino language is doing?
magbias = +470.;
It is not the same as magbias += 470
, right?
Upvotes: 1
Views: 1121
Reputation: 21
magbias +=470 means magbias = magbias + 470; i.e. its adds in 470 to the previous value and stores it in the same variable. magbias = +470; is defining value to the variable.
Upvotes: 0
Reputation: 718708
Anybody can tell me what is this operation doing?
The +
is the unary plus operator, and it is effectively a no-op.
magbias = +470;
is equivalent to
magbias = 470;
It is not the same as magbias += 470, right?
Correct.
Normally, I would say "read the language reference", but in this case, the reference document doesn't describe the unary +
or unary -
operators. They are just listed in the operator precedence table.
Upvotes: 1