Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Tutorial for Increment/Decrement operators

What is Increment/Decrement operators?

These operations raise (increase) or reduce (decrease) the value of a vector (decrease). Because just one operator is employed, they are frequently referred to as uniform operators. To raise or reduce a value by a factor of one, operators for increasing and decreasing are used. Pre-incrementing operator The new $x value is returned when the value is added to it. See the table below for a better understanding:

  • Operator Name Description
  • ++$x Pre-increment Increments $x by one, then returns $x
  • $x++ Post-increment Returns $x, then increments $x by one
  • --$x Pre-decrement Decrements $x by one, then returns $x
  • $x-- Post-decrement Returns $x, then decrements $x by one

Example:-

Output:-

Tagged : / / / / / /