Dec()

From TinyMUX
Jump to: navigation, search

Description

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

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

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

Examples

> say dec()
-1
> say dec(100)
99

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, dec() does not perform simple subtraction. Instead, it subtracts 1 from the last string of digits present in its argument. This means that dec(hi3) => hi2, but also means that dec(1.3) => 1.2, which may be surprising. Use sub() for true subtraction.