1

Possible Duplicate:
What is the difference between += and =+?

I know what saying x+=1; means

but what does

saying x=+1; mean?

Community
  • 1
  • 1
Tegra Detra
  • 24,551
  • 17
  • 53
  • 78

3 Answers3

13

There is no =+ operator. x=+1 simply means assign +1 (positive 1) to x.

casablanca
  • 69,683
  • 7
  • 133
  • 150
  • hurm It must be an odd contruct of the api I use, I assumed it was part of the Java Language because I know in C it is a post operator. – Tegra Detra Aug 25 '10 at 05:47
  • @Doodle: There is no such operator in C either. The post-increment operator is `++`, which is present in Java as well. – casablanca Aug 25 '10 at 15:40
4

It assigns a value of +1 to variable x.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
0

x += 1 can also be written as x = x + 1

Russell Dias
  • 70,980
  • 5
  • 54
  • 71