Jump to content

two conditions in an IF statement?


gcue
 Share

Recommended Posts

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
Link to comment
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
Link to comment
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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...