Gamma: Version 4.0
Prev |  | Next

# Ternary Operator

Ternary Operator -- ( `? :` )

## Syntax

    condition ? number : number

## Arguments

`condition`

  Any Gamma or Lisp expression.

`number`

  Any integer or real number.

## Returns

The first `number` if the `condition` is true, otherwise the second `number`.

## Examples

        Gamma> a = t ? 2 : 8;
        2
        Gamma> a;
        2
        Gamma> b = (a == 7) ? 2 : 8;
        8
        Gamma> b;
        8
        Gamma>

See the Button Functions section of the GTK Functions chapter (Tutorial One), or the Button Functions section of the Photon Functions chapter (Tutorial One) in the Cogent Tools Demo and Tutorials book for examples of this function used in context.

Prev | Home | Next
Quote Operators | Up | Statements

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