This is my 1st Daily Tips for programmer.
Many developers, especially junior developer when they dealing with simple math operation they will be doing something like this:
There's no wrong with that code above. But we can simplify with Augmented Assignments. Basically, an Augmented assignment is generally used to replace a statement where an operator takes a variable as one of its arguments and then assigns the result back to the same variable.
Instead of assigning x
variable with x = x + 1
we can make them more clean like this.
So, how?
Let's see other simple math operation
Top comments (0)