String or number?

Ken Ray kray at sonsothunder.com
Tue Jun 19 12:44:59 EDT 2007


On Tue, 19 Jun 2007 12:07:25 +0200, Torbjörn Nordlindh wrote:

> Anyway, here's the real puzzle:
> 
> If you
> put 1 into a
> put 1 + 0 into b
> 
> Then a is a number and b is a number and a is an integer and b is an 
> integer and a=b.
> 
> Split treats them differently:
> 
> split a by comma gives an array
> split b by comma is still a number
> 
> So, the question is:
> 
> What's the difference between a and b?

"a" is still a string, and "b" is a number (since you forced it to be 
one by adding 0). When you do the "is an integer" test, Rev coerces "a" 
to see if it can be evaluated as an integer - since it can, you get 
"true"... but the variable "a" remains a string.


Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/



More information about the use-livecode mailing list