Decrement

Article on other languages:

del.icio.us del.icio.us
Digg Digg
Furl Furl
Reddit Reddit
Rojo Rojo
Add to OnlyWire

An increment is an increase, either of some fixed amount, for example added regularly, or of a variable amount. For example, a salary may receive an annual increment. A decrease would rather be called a decrement.

Incremental may also refer to gradual change as opposed to massive, instant change.

Use in science and technology

Incremental changes are gradual improvements as opposed to revolutionary, paradigm-breaking changes - i.e. whereas the invention of inner tube tires was only an incremental change to wheels, the invention of the combustion engine was a revolutionary change over animal-drawn vehicles.

Use in programming languages

Incrementing is of constant use in computer programming, such as in loops that iterate through a set of items one at a time.

For example, in JavaScript, which inherits the syntax from languages such as C, C++, and Java, the increment unary operator works like the following:

x++

Where the decrement operator is:

x--

In addition, the increment operator can be written both as x++ and ++x, with separate meanings. For example:

 var y = ++x

is shorthand for:

 x = x+1
 var y = x

however,

var y = x++

is shorthand for:

 var y = x
 x = x+1

--x instead of x-- follows similar behavior.

Some languages, such as C and C++, do not specify when the increment occurs, whether immediately before (or after) use, at the beginning (or end) of the statement, or at some point in between. For this reason, referencing a variable more than once in a statement where the increment operator is used results in undefined behavior. The same code may produce different results on different compilers, different architectures, or even the same compiler with different optimization settings. For example,

int x = 0
x = x++

may result in x having either the value 0 or 1. Similarly,

int x = 0
int y = x++ + x++

may result in y having either the value 0 or 1.

See also

Look up Increment in
Wiktionary, the free dictionary.

This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License.


Giant Panda

Mercedes Car
James Bond Guide
This site monitored by SitePinger.net