Gamma: Version 4.0
Prev |  | Next

# Arithmetic Operators

Arithmetic Operators -- (`+`, `-`, `*`, `/`, `%`)

## Syntax

    number + number
    number - number
    number * number
    number / number
    number % number

## Arguments

`number`

  Any integer or real number. Non-numbers are treated as zero.

## Returns

The mathematical result of the operation.

## Description

These operators perform simple mathematical operations on their arguments.

+ gives the sum of the two arguments.

- gives the difference between the first and second arguments.

* gives the product of the two arguments.

/ gives the first argument divided by the second argument.

% gives the modulus of the first argument by the second, that is, the remainder of the integer division of the first argument by the second.

## Example

        Gamma> 5 + 6;
        11
        Gamma> 12 / 5;
        2.3999999999999999112
        Gamma> div(12,5);
        2
        Gamma> 19 % 5;
        4
        Gamma>

Prev | Home | Next
Operator Precedence and Associativity | Up | Assignment Operators

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