basic.-

Operator/BASIC Program, Releases: AP and R83

Mathematical operator (subtract). Also unary minus.

Syntax

num.expression - num.expression

Description

designates a subtraction operation, or to indicate a negative numeric value.

Example

x = x - 1
Subtracts '1' from the contents of variable 'x'.

x = x + (-z)
Negates the contents of 'z' and adds to the contents of
'x'. The result is placed in 'x'.

amount = price - discount.amount
Subtracts the contents of the variable 'discount.amount' from the
variable 'price'. Places the result in the variable
'amount'.

amount = (unit.cost * qty) - discount.amount
Subtracts the contents of variable 'discount.amount' from the product
of 'unit.cost' and 'qty'. The parenthesis '()'
used to group precedence are unnecessary due to default precedence. They are
added for program clarity.

counter = -1
This assigns the value, '-1', to the variable 'counter'.

See Also

Command Name Type Description
basic.num.expression Definition An expression which evaluates to a number.
basic.precedence Definition Precedence of compound expressions.
basic.operators Relational Operator Operators * ! & = # - + / ^ < > \ [ ] ( )
arithmetic.operators Definition add, subtract, multiply, and divide numeric operands in arithmetic expressions.
basic.arithmetic.expressions Definition Arithmetic expressions.
basic.special.characters Reserved Character Reserved characters and their functions.
basic.+= Assignment Operator Adds numeric expression and assigns to variable.
basic.:= Assignment Operator Concatenates expression and assigns to variable.
basic.-= Assignment Operator Subtracts numeric expression and assigns to variable.
basic.precision Statement Defines precision for calculations.
basic./= Assignment Operator Divides numeric expression and assigns to variable.
basic.+ Operator Arithmetic operator (add). Also unary plus.
basic.*= Assignment Operator Multiplies numeric expression and assigns to variable.

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.