Programmer Guide/Command Reference/WORDS: Difference between revisions

From STX Wiki
Jump to navigationJump to search
m (1 revision: Initial import)
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
==WORDS==
The <code>WORDS</code> returns the number of arguments ("words" in a broader, or more technical, meaning) supplied to the command.
 
<var>var</var> := WORDS <var>arg<sub>1</sub></var> <var>arg<sub>2</sub></var> ... <var>arg<sub>n</sub></var>
<code><var>var</var> := WORDS <var>wordList</var></code>
Note the difference between what is called a word in everyday-use, and what is called a word (an argument) here:
 
Generally, if you supply <var>n</var> arguments to the <code>WORDS</code> command, it will return the number <var>n</var>, even if one of the arguments should consist of more than one "word" of natural language.
-> var = 'numberOfWords'
#v1 := WORDS don`'t come easy      // #v1 will be set to 3
 
#v2 := WORDS 'don`'t come' easy    // #v2 will be set to 2
Return the number of blank separated words in the list <var>wordList</var>.
#v3 := WORDS 'don`'t' 'come easy'  // #v3 will be set to 2, too
#v4 := WORDS 'don`'t come easy'    // #v4 will be set to 1

Revision as of 15:54, 23 March 2011

The WORDS returns the number of arguments ("words" in a broader, or more technical, meaning) supplied to the command.

var := WORDS arg1 arg2 ... argn

Note the difference between what is called a word in everyday-use, and what is called a word (an argument) here: Generally, if you supply n arguments to the WORDS command, it will return the number n, even if one of the arguments should consist of more than one "word" of natural language.

#v1 := WORDS don`'t come easy       // #v1 will be set to 3
#v2 := WORDS 'don`'t come' easy     // #v2 will be set to 2
#v3 := WORDS 'don`'t' 'come easy'   // #v3 will be set to 2, too
#v4 := WORDS 'don`'t come easy'     // #v4 will be set to 1

Navigation menu

Personal tools