Advertisement
johanntagle

Go Assignment Operators

Nov 11th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. // Incrementing
  2. var age = 20
  3.  
  4. // the following lines all increment the value of age by 1
  5. age = age + 1
  6. age += 1
  7. age++
  8. // there's also:
  9. age = age - 2
  10. age -= 2
  11. age++ // this only decrements by 1
  12.  
  13.  
  14. var this_value = 40
  15.  
  16. // divides by 2
  17. this_value /= 2
  18.  
  19. // multiplies by 3
  20. this_value *= 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement