Inc()

From TinyMUX
Revision as of 05:05, 17 January 2006 by Ian (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Description

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