Hi Camster,
Livecode does not have types. Basically everything is treated as string and turned into a integer when asked to.
Code: Select all
on mouseUp
put "these 5 brave people" into field 1 -- obviously a string
wait 1000 milliseconds -- let's see it
add 1 to word 2 of field 1 -- word 2 is treated as integer inside a string
wait 1000 milliseconds
try
add 1 to word 1 of field 1 -- this will not work since word 1 is not an integer
catch tErr
put cr & tErr after field 1 -- see the error
end try
end mouseUp
since it is not possible to add 1 to word 1 (these) this will throw an error
Jacque has made a stack to look up error codes:
http://revonline2.runrev.com/stack/712/ ... ror-Lookup
So you don't have to declare types, just use them implicitly. Probably this takes a bit getting used to but will feel natural after a short while.
There are subtleties in string number conversions that are hidden in everyday use
for a discussion
http://www.sonsothunder.com/devres/live ... crp007.htm
So Marek has a point in his post. But this is behind the scene and you are not forced to add 0 to a variable to make it an integer. It will increase execution speed a bit in special situations though.
Kind regards
Bernd