Jump to content
Sign in to follow this  
idoru

Boolean Syntax Help

Recommended Posts

idoru

Hi Guys,

I hate to bother you with what I think is a syntax problem but your my only hope of me keeping my hair till lunch time.

I have the following code

If $chassis=(8 OR 9 OR 10 OR 11 OR 12 OR 14) Then
                       (DO SOMETHING)
    Elseif $chassis=(1 OR 2 OR 3 OR 4 OR 5 OR 6 OR 7) Then
                        (DO SOMETHING ELSE)
            EndIf
    EndIf

Even if $chassis = 1 it runs the (DO SOMETHING) rather than the (DO SOMETHING ELSE). I assume this is because my syntax is horribly wrong as the help file states that If's can use boolean operators.

Can anyone help?

Share this post


Link to post
Share on other sites
thomaatje

CODE
If $chassis = 8 OR $chassis = 9 OR $chassis = 10 OR $chassis = 11 OR $chassis = 12 OR $chassis = 14 Then

(DO SOMETHING)

Elseif $chassis = 1 OR $chassis = 2 OR $chassis = 3 OR $chassis = 4 OR $chassis = 5 OR $chassis = 6 OR $chassis = 7 Then

(DO SOMETHING ELSE)

EndIf

Share this post


Link to post
Share on other sites
November

Hi there,

Is it suitable for you?

If $chassis>= 8  and $chassis <= 14 then
                       (DO SOMETHING)
    Elseif $chassis>= 1 and $chassis <= 7
                        (DO SOMETHING ELSE)
            EndIf
    EndIf

Cheers


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites
idoru

Thanks Forsaken much obliged!

For the record I think my way would be better (or at least easier to read).

Share this post


Link to post
Share on other sites
idoru

Thanks again November but my values don't run as neatly as that :D

Share this post


Link to post
Share on other sites
November

Thanks again November but my values don't run as neatly as that :D

Ok, i dont know the rest of code :D

So you should stick with the other solution, so that your variables don't lose value ;)

Cheers


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites
Malkey

Here is another method you can consider..

;
Local $chassis = 10

Switch $chassis
    Case 8 To 12, 14
        MsgBox(0, "", "DO SOMETHING")
    Case 1 To 7
        MsgBox(0, "", "DO SOMETHING ELSE")
EndSwitch
;

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.