counting empty items

J. Landman Gay jacque at hyperactivesw.com
Mon May 24 13:46:18 EDT 2004


On 5/24/04 12:09 PM, rand valentine wrote:

>  If I do this:
> 
> set the itemDelimiter to tab
> put the number of items of tab & tab & tab & tab
> 
>  1 is returned.
> 
> why not 4? I don't get it.
> 
>  -- if I do this:
> 
> set the itemDelimiter to tab
> put empty into item 4 of testVariable
> put the number of items of testVariable
> 
>  3 is returned.
> 
> why?

Because without forcing the compiler to parse the tabs in the first 
case, each tab is considered a text string. The concatenation looks like 
this:

  "tabtabtabtab"

If you put parentheses around it, the compiler will evaluate the 
constants first before working with the string:

   put the number of items of (tab & tab & tab & tab)

Gives 4.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com


More information about the use-livecode mailing list