Combining AND OR in a IF Statement

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Shadow3641
Junior Coder
Posts: 26
Joined: Thu Nov 17, 2016 2:45 pm

Combining AND OR in a IF Statement

Post by Shadow3641 » Thu Nov 17, 2016 3:59 pm

Hello and Sorry if this has been addressed but i can not find anything on it

What i'm trying to do is put up a If statement to look at points and also a range what i tried to come up with is this.

Code: Select all

Let>Loop=20
If>{(%Loop%=1) OR {(%Loop%>=12) AND (%Loop%<=21)} OR (%Loop%=22) OR (%Loop%=23)}
   Let>IntExt=Uni
 Endif
this does not work but was wondering if there is a way to do this and or make it cleaner

Thanks for the help

Shadow3641
Junior Coder
Posts: 26
Joined: Thu Nov 17, 2016 2:45 pm

Re: Combining AND OR in a IF Statement

Post by Shadow3641 » Thu Nov 17, 2016 5:28 pm

Never mind overthinking it all i had to do was remove the {} but if any one knows a way to make it more compact that would still be good.

Code: Select all

 
If>{(%Loop%=1) OR (%Loop%>=12) AND (%Loop%<=21) OR (%Loop%=22) OR (%Loop%=23)}
     Let>IntExt=Uni
Endif

zabros2020
Pro Scripter
Posts: 70
Joined: Sun May 03, 2009 11:49 pm
Location: AU

Re: Combining AND OR in a IF Statement

Post by zabros2020 » Mon Nov 21, 2016 5:43 am

why not:

Code: Select all

Let>Loop=20

 If>{(%Loop%=1) OR (%Loop%>=12) AND (%Loop%<=23)}
 
 Let>IntExt=Uni
 
 Endif
Loving MS's Capabilities!!!

Shadow3641
Junior Coder
Posts: 26
Joined: Thu Nov 17, 2016 2:45 pm

Re: Combining AND OR in a IF Statement

Post by Shadow3641 » Tue Nov 22, 2016 1:07 am

lol I did not even see that. Yes i suppose that would be shorter, but i have some parts of my code that go at random points all the way too 100. So in some If> statements i have the (%Loop%=#) repeated 50 times which makes out to be a vary long rung.

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