If else statment is not working

Peter Brigham MD pmbrig at gmail.com
Thu Apr 22 14:25:43 EDT 2010


You wrote:

>> write "XYZ"  & return to socket tSocket
>> if "XYZ"  then
>>    click at the loc of btn "StartXYZ"
>> else "ABC"  then
>>    click at the loc of btn "StartShani"
>> end if

If-then statements will evaluate the condition tokens as true or false  
and proceed accordingly. So in evaluating your line:

if "XYZ" then...

the engine will look at "XYZ", which is a literal string, and find  
that this string does not evaluate to "true" and then go to:

else if "ABC" then
(inserting the extra if, as Mark suggests)

and find that "ABC" does not evaluate to "true", and thus nothing will  
happen. What you need is something like:

if myVariable = "XYZ"  then
    click at the loc of btn "StartXYZ"
else if myVariable = "ABC" then
    click at the loc of btn "StartShani"
end if

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig


On Apr 22, 2010, at 12:06 PM, Mark Schonewille wrote:

> Shani,
>
> else "ABC"  then
>
> should be
>
> else if "ABC" then
>
> --
> Best regards,
>
> Mark Schonewille
>
> Economy-x-Talk Consulting and Software Engineering
> Homepage: http://economy-x-talk.com
> Twitter: http://twitter.com/xtalkprogrammer
>
> We have updated TwistAWord. Download TwistAWord 1.1 at http://www.twistaword.net
>
> Op 22 apr 2010, om 18:04 heeft Shani het volgende geschreven:
>
>> If then else statement is not working.
>>
>>
>>
>>
>>
>>
>>
>> write "XYZ"  & return to socket tSocket
>>
>>
>>
>>
>> if "XYZ"  then
>>
>>
>>
>>
>> click at the loc of btn "StartXYZ"
>>
>>
>>
>>
>> else "ABC"  then
>>
>>
>>
>>
>> click at the loc of btn "StartShani"
>>
>>
>>
>>
>> end if
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list