Jump to content

Rebol Programming/sign?

From Wikibooks, open books for an open world

USAGE:

[edit | edit source]
SIGN? number 

DESCRIPTION:

[edit | edit source]

Returns sign of number as 1, 0, or -1 (to use as multiplier).

SIGN? is a function value.

ARGUMENTS

[edit | edit source]
  • number -- (Type: number money time)

SOURCE CODE

[edit | edit source]
sign?: func [
    {Returns sign of number as 1, 0, or -1 (to use as multiplier).} 
    number [number! money! time!]
][
    either positive? number [1] [either negative? number [-1] [0]]
]