Inc()

From TinyMUX
Jump to: navigation, search

Description

FUNCTION: 20px-Function.png inc(number)

Returns number plus 1. Faster and more efficient than add(number, 1). Because number is treated as an integer, decimal places are truncated. An empty arguement is treated as zero.

Related Topics: sub(), add(), dec().

Examples

> say inc()
1
> say inc(100)
101

Server Differences

TinyMUX supports 64-bit numbers on both 32-bit and 64-bit platforms. TinyMUSH and RhostMUSH support the native integer size (32-bit or 64-bit depending on the platform) with the caveat that RhostMUSH does not compile on 64-bit platforms.

On PennMUSH, inc() does not perform simple addition. Instead, it adds 1 to the last string of digits present in its argument. This means that inc(hi2) => hi3, but also means that inc(1.3) => 1.4, which may be surprising. Use add() for true addition.