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:-

Ashwani Kumar
Latest posts by Ashwani Kumar (see all)
Tagged : / / / / / /
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x