Sign in to follow this  
Followers 0
gcue

two conditions in an IF statement?

11 posts in this topic

is this possible?

If $broadcast="2" AND status<>"" Then

Share this post


Link to post
Share on other sites



is this possible?

If $broadcast="2" AND status<>"" Then

Why ask? Code a three line script to test it! What happens?

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

u have it there?

i tried what i wrote, didnt work.

Share this post


Link to post
Share on other sites

Hi,

i tried what i wrote, didnt work.

If $broadcast="2" AND status<>"" Then

Can you please let us know what do you want to do with these?

For example:

$broadcast = "2" 
$status = ""
if $broadcast = "2" and $status = "" Then
    MsgBox (0, "Result", "True")
Else
    MsgBox (0, "Result", "False")
EndIf

It will have a result as "True"

$broadcast = "1" 
$status = ""
if $broadcast = "2" and $status = "" Then
    MsgBox (0, "Result", "True")
Else
    MsgBox (0, "Result", "False")
EndIf

It will have a result as "False"


Henry

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

When you are comparing numbers, don't use quotes.

EDIT: Typo

Edited by weaponx

Share this post


Link to post
Share on other sites

gotcha..

thank you all for your help!

have a good weekend!

Because then you would be comparing... Strings :D

Share this post


Link to post
Share on other sites

Hi Weaponx,

When you are comparing numbers, don't use quotes.

EDIT: Typo

Thanks for the input. :D Finally, OP can get his answer :D


Henry

Share this post


Link to post
Share on other sites

A couple of other quick comments.

Empty strings are 'false', so you don't need the '<>""' at all.

When in doubt, use parens (in fact, it's a good habit to use them even when you're not in doubt).

If $status And ($broadcast = 2) Then 
  msgbox(0,'','broadcast is 2, and we have a status')
else
  msgbox(0,'','broadcast is not 2, or we have no status')
EndIf

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  
Followers 0