Jump to content

Help Me With Operators.


Recommended Posts

My problem is i am trying to quickly code something for a ordering application that would ask a person what table they are on and if the table number entered is between 1 and 25 then it carries on as normal and if anything is outside of these boundaries then it will display an error. I figured this would be very simple to code with using 2 sets of operators in one line so i made a test code, unfortunately AutoIt doesn't like this for some reason could anyone post me a solution. ;)

Test Code

$TableNumber = InputBox("Table Number", "Please Enter A Table Number From 1-25")
If $TableNumber >=1 And <= 25 Then
   MsgBox(0, "Table", "Table Is Ok")
Else
   MsgBox(0, "Table", "Table Is Bad")
EndIf

If possible please give me an understanding of why this code wont work, i was almost positive it would.

Edited by Venix
Link to comment
Share on other sites

And another method...

Not necessarily better, but to add some spice to your thread ;)

$TableNumber = InputBox("Table Number", "Please Enter A Table Number From 1-25")
Switch $TableNumber
    Case 1 to 25
        MsgBox(0, "Table", "Table Is Ok")
    Case Else
        MsgBox(0, "Table", "Table Is Bad")
EndSwitch
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...