Jump to content

Recommended Posts

Posted

$vHealthCheck = ($vHealth / 25)

If $vHealthCheck = 1 OR 2 OR 3 OR 4 Then

MsgBox(0, "Congratz", "It works great")

Else

MsgBox(0, "Failed", "Your number is incorrect")

EndIf

That's what I have so far, but it always comes back as the first message box (The correct one)

I have used numbers like 20 and 5 and 125.

Posted (edited)

If $vHealthCheck = 1 OR 2 OR 3 OR 4 Then

$vHealthCheck = ($vHealth / 25)
If $vHealthCheck = 1 OR $vHealthCheck =2 OR $vHealthCheck =3 OR $vHealthCheck =4 Then
MsgBox(0, "Congratz", "It works great")
Else
MsgBox(0, "Failed", "Your number is incorrect")
EndIf

Use of Or sounds like your problem.

if 1 then
MsgBox(0, "Congratz", "It works great")
endif

actually a good spot for line continuation Shameless plug of Unofficial help file

$vHealthCheck = ($vHealth / 25)
If $vHealthCheck = 1 OR _
 $vHealthCheck =2 OR _
 $vHealthCheck =3 OR _
 $vHealthCheck =4 Then
MsgBox(0, "Congratz", "It works great")
Else
MsgBox(0, "Failed", "Your number is incorrect")
EndIf
Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Posted

Alright, thanks, I'll use that for now. But if anyone can determine if OR is allowed, please let me know.

Posted

Sorry for the double post, but I can't click the edit button without getting logged out. But I found the answer!! The correct usage is

If $vHealthCheck = 1 OR $vHealthCheck = 2 OR $vHealthCheck = 3 OR $vHealthCheck = 4

Posted

$vHealthCheck = ($vHealth / 25)
If $vHealthCheck = 1 OR _
 $vHealthCheck =2 OR _
 $vHealthCheck =3 OR _
 $vHealthCheck =4 Then
MsgBox(0, "Congratz", "It works great")
Else
MsgBox(0, "Failed", "Your number is incorrect")
EndIf

He gave you the correct answer there, lines contiued with the underscore, is the only difference.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

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
  • Recently Browsing   0 members

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