johanntagle icon

Go Assignment Operators

johanntagle | PRO | 11/12/19 02:32:32 AM UTC | 0 ⭐ | 292 👁️ | Never ⏰ | []
text |

320 B

|

None

|

0 👍

/

0 👎

// Incrementing
var age = 20
 // the following lines all increment the value of age by 1
age = age + 1             
age += 1
age++
// there's also:
age = age - 2             
age -= 2
age++ // this only decrements by 1
  var this_value = 40
 // divides by 2
this_value /= 2
 // multiplies by 3
this_value *= 3

Comments