if statement

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
durana
Junior Coder
Posts: 21
Joined: Tue Feb 22, 2005 3:08 pm

if statement

Post by durana » Thu Mar 24, 2005 1:10 pm

Hello ,

I have a question about the if statement. This one is not working for me, even when I copy from the example in the help function.

What do I do wrong ?

//complex expression:
IF>{(%a% = 5) AND (%VarA% = "allen")}
//do something
ELSE
//do something else
ENDIF


- The editor doesn't understand the endif statement also...
- why don't I see in the example see ">" afther else en endif.
- the and and or are not working also........

strange ..

Thanks if someone can check this out.

Regards Duran

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Thu Mar 24, 2005 1:59 pm

Hi,

Works fine for me. Of course you do need to initialise those variables or it will fail:

Let>a=5
Let>VarA=allen
IF>{(%a% = 5) AND (%VarA% = "allen")}
MessageModal>True
ELSE
MessageModal>False
ENDIF

Check for trailing spaces when you paste this into the editor.
MJT Net Support
[email protected]

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Thu Mar 24, 2005 2:03 pm

The following script works perfectly fine.
Let>a=3
Let>VarA=Armstrong
//complex expression:
IF>{(%a% = 5) AND (%VarA% = "allen")}
//do something
ELSE
//do something else
ENDIF

durana
Junior Coder
Posts: 21
Joined: Tue Feb 22, 2005 3:08 pm

Post by durana » Thu Mar 24, 2005 3:21 pm

Hello,

When I do the same, the script continues after the first stament to the else statement.

And like I said, i looks like the endif is not recognized.

Strange .... i have version 7.2.050 is this the problem probably ?

Duran

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Thu Mar 24, 2005 3:29 pm

AH! LOL! ELSE/ENDIF wasn't added until 7.3. So, yes, that's your problem. The version you have doesn't support complex expressions either. See history list here:
http://www.mjtnet.com/index.htm?page=mswhatsnew.html
MJT Net Support
[email protected]

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts