Name: subtract

Type: command

Syntax: subtract <number> from [<chunk> of] <container>

Syntax: subtract {<number> | <array>} from <arrayContainer>

Summary:
Subtracts a number from a <container> and places the resulting <value>
in the <container>.

Introduced: 1.0

OS: mac, windows, linux, ios, android

Platforms: desktop, server, mobile

Example:
subtract 5 from tSize

Example:
put "10,10" into tPoint
subtract 5 from item 2 of tPoint -- subtracts 5 from the second item

# RESULT
# tPoint = 10,5

Example:
put 10 into tArray["height"]
put 10 into tArray["width"]
subtract 5 from tArray -- subtracts 5 from both width and height

# RESULT
# tArray["height"] = 5
# tArray["width"] = 5

Parameters:
number:
Any expression that evaluates to a number.

chunk:
A chunk expression specifying a portion of the container.

container:
A field, button, or variable, or the message box.

array (array):


arrayContainer (array):
An array variable each of whose elements is a number.


Description:
Use the <subtract> <command> to subtract a number from a <container> or
a portion of a <container>, or to subtract two <array|arrays> containing
numbers. 

The contents of the <container> (or the <chunk> of the <container>) must
be a number or an <expression> that <evaluate|evaluates> to a number.

If a <number> is subtracted from an <arrayContainer>, the <number> is
subtracted from each <element(keyword)>. If an <array> is subtracted
from an <arrayContainer>, both <array|arrays> must have the same number
of <element(glossary)|elements> and the same dimension, and each
<element(keyword)> in the <array> is subtracted from the corresponding
<element(keyword)> of the <arrayContainer>.

If the <container> or an <element(keyword)> of the <arrayContainer> is
empty, the <subtract> <command> treats its contents as zero.

If <container> is a <field> or <button>, the <format> of the sum is
determined by the <numberFormat> <property>.

If a math operation on finite inputs produces a non-finite output, an
execution error is thrown. See <math operation|math operations> for more
information.

References: multiply (command), format (function), value (function),
property (glossary), element (glossary), container (glossary),
expression (glossary), array (glossary), evaluate (glossary),
command (glossary), field (keyword), element (keyword), button (keyword),
- (operator), numberFormat (property), math operation (glossary)

Tags: math

