int

Gamma: Version 4.0
Prev |  | Next

# `int`

`int` -- converts to integer form.

## Syntax

    int (s_exp)

## Arguments

`s_exp`

  Any Gamma or Lisp expression.

## Returns

An integer representation of the argument.

## Description

This function converts the argument to an integer. Floating point numbers are truncated. Binaries, hexadecimals and characters convert to decimal integers. In strings, if the first character(s) are numerical, they will be converted to an integer. Otherwise, a string will return zero. All other expression types generate zero.

## Example

        Gamma> int(5.5);
        5
        Gamma> int(0xc);
        12
        Gamma> int(0b111011);
        59
        Gamma> int('h');
        104
        Gamma> int("63 hello");
        63
        Gamma> int("hello 63");
        0
        Gamma> int(random());
        0
        Gamma>

## See Also

Literals

Prev | Home | Next
`hex` | Up | `number`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.