error in test contion

Alex Tweedly alex at tweedly.net
Fri Oct 25 18:45:14 EDT 2013


(Answering backwards .... :-)

I'd find it to confusing to deal with a statement like that "if ... 
then" one you wrote.

(I would be forever asking myself
    Is 'not" higher or lower precedence than 'or' ?
    Does that 'not' apply to the whole of the res of the expression, or 
just the first clause ??

  I don't remember - and the dictionary entries don't help - they say 
that I can combine 'and', 'or' and 'not - but don't mention which is 
higher precedence).

So just to save myself mental effort, I'd do something like ....

put not exists(...) into tCond1
put (the prgVrsn of stack "mcp" <> progVersion) into tCond2
if tCond1 OR tCond2 then ....

And that might either resolve, or failing that help with, the question 
of what the error message is trying to say.

-- Alex.


On 25/10/2013 22:19, Dr. Hawkins wrote:
>   I store the program version, calculated from the filename, as a custom
> property of the main stack.  So when the filename changes, the following
> code comes into play when opening:
>
> put exists (the prgVrsn of stack "mcp") , (the prgVrsn of stack "mcp" <>
> progVersion)
> if not exists (the prgVrsn of stack "mcp") OR (the prgVrsn of stack "mcp"
> <> progVersion) then
>
>           set the prgVrsn of stack "mcp" to progVersion
>
>
> The put executes, with false, false r some such.
>
> But then the test causes the message,
>
> Type    if-then: error in statement
> Object    mcp
> Line    if not exists (the prgVrsn of stack "mcp") OR (the prgVrsn of stack
> "mcp" <> progVersion) then
> Hint    openMcp
>
>





More information about the use-livecode mailing list