Name: number

Synonyms: num

Type: function

Syntax: the number of [{card|cd|background|bkgnd|bg}] {<objectType> | parts | controls}

Syntax: the number of {<objectType> | parts | controls} [{in | of} <groupRef>]

Syntax: the number of {backgrounds | groups} [ [{in | of} <cardRef>] {in | of} <stackRef>]

Syntax: the number of [marked] cards [{in | of} <stackRef>]

Syntax: the number of {char[acters] | items | words | lines} {in | of} <textString>

Syntax: the number of elements {in | of} <arrayExpr>

Summary:
<return|Returns> the number of <object|objects> of a certain kind, or
the number of <chunk|chunks> in a <string>.

Introduced: 1.0

OS: mac, windows, linux, ios, android

Platforms: desktop, server, mobile

Example:
repeat for the number of words in inputString

Example:
if the number of card buttons &gt; 0 then doTheButtons

Parameters:
objectType(enum):
- buttons (or btns):
- fields (or flds):
- images:
- graphics (or grcs):
- players:
- scrollbars:
- EPSs:
- audioClips:
- videoClips:
- groups:
- backgrounds:
- cards:

groupRef:
A reference to any group in the current stack.

cardRef:
A reference to any card in the current stack.

stackRef:
Any stack reference.

textString (string):
Any string or expression that evaluates to a string.

arrayExpr (array):
Any array or expression that evaluates to an array.

Returns(integer):
The <number> <function> <return|returns> a <non-negative> <integer>.

Description:
Use the <number> <function> to find out how many of a thing there are.

If you use the form `the number of card controls`, the <number> <function>
returns the number of <control|controls> on the <current card> that are
not members of a <group(command)>. The form `the number of background
controls` returns the number of grouped controls that are in a
<group(command)> whose <backgroundBehavior> <property> is set to true.

The <expression>

    the number of chars in &lt;textString&gt;

is equivalent to:

    the length of &lt;textString&gt;

The <expression>

    the number of backgrounds of &lt;stackRef&gt;

<return|returns> the number of <group(glossary)|groups> in the <stack>.

The <expression>

    the number of groups of &lt;stackRef&gt;

returns the number of <group(glossary)|groups> on the <current card> of
the <stack>. <group(glossary)|Groups> that are <nest|nested>
inside another <group(command)> are not counted.

>*Note:* The <number> is implemented as a <read-only> <global>
> <property>, but can be more conveniently thought of as a <function>.

References: global (command), group (command),
function (control structure), length (function), property (glossary),
current card (glossary), return (glossary), group (glossary),
nest (glossary), chunk (glossary), read-only (glossary),
expression (glossary), non-negative (glossary), object (glossary),
string (keyword), control (keyword), integer (keyword), stack (object),
backgroundBehavior (property), layer (property)

Tags: text processing
