Using 'try'
Alex Tweedly
alex at tweedly.net
Thu Apr 13 18:36:38 EDT 2006
Mark Wieder wrote:
> <snip>
>
> but basically the "try"
>construct here lets me set the field to empty without running into a
>runtime error. Without the try the code would give me an error on the
>first line if pValue is empty, since it would try to execute
>
>if < 0 then
>
>
>
Mark,
I see the general point (any error within the "try" clause will be
ignored), I don't see the need for it in this case.
I can't find any case where comparing "empty" against a value gives an
error; I tried it in simple code, as a handler and as a setProp, and
none of them gives an error.
> on mouseUp
> put empty into t
> if t < 0 then
> put "less"
> end if
> myHandler
> set the NewValue of me to empty
> end mouseUp
>
> on myHandler pVar
> if pVar < 0 then
> put "it is less" after msg
> else
> put "greater" after msg
> end if
> put "it is done" after msg
> end myHandler
>
> setProp NewValue pVar
> if pVar < 0 then
> put "it is less" after msg
> else
> put "greater" after msg
> end if
> put "it is done" after msg
> end NewValue
>
as far as I can tell, none of these give run time errors (Win XP, 2.6.1)
Am I missing a case where this comparison gives a problem ?
Or was it just an example and I shouldn't read too much into the
specific case used ?
--
Alex Tweedly http://www.tweedly.net
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.4.1/310 - Release Date: 12/04/2006
More information about the use-livecode
mailing list