Programmer Guide/Command Reference/WORDS: Difference between revisions
From STX Wiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:{{SUBPAGENAME}}}} | {{DISPLAYTITLE:{{SUBPAGENAME}}}} | ||
{{PG_StringCommands}} | |||
The {{STx}} comnmand <code>WORDS</code> returns the number of arguments ("words" in a broader, or more technical, meaning) supplied to the command. | The {{STx}} comnmand <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> | <var>var</var> := WORDS <var>arg<sub>1</sub></var> <var>arg<sub>2</sub></var> … <var>arg<sub>n</sub></var> |
Latest revision as of 10:27, 4 March 2016
The STx comnmand 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