ADD

Syntax

ADD{src_num_lit | _var |  _col} TO dst_num_var  [ROUND=nn]

Description

Adds one number to another.

The source value is added to the destination variable and the result is placed in the destination. The source is always first and the destination is always second.

When dealing with money-related values, use decimal variables rather than float variables. Float variables are stored as double-precision floating point numbers, and small inaccuracies can occur when a program is adding many numbers in succession. These inaccuracies can appear due to the way floating point numbers are represented by different hardware and software implementations and also due to inaccuracies that can be introduced when a program is converting between floating point and decimal.

Parameters

Parameter Description

src_num_lit | _var | _col

Source number literal, variable, or column.

dst_num_var

A numeric destination variable that contains the result after execution.

ROUND

Rounds the result to the specified number of digits to the right of the decimal point. For float variables, this value can be from 0 to 15. For decimal variables, this value can be from 0 to the precision of the variable. For integer variables, this argument is not appropriate.

Example

To add 10 to #counter:

add  #counter  to  #new_count
add  &price  to  #total  round=2

See LET Command