Jump to content

error


Recommended Posts

Conditionally run statements.

Related

If...Then, If...Else...EndIf

Example

Select
    Case $var = 1
        MsgBox(0, "", "First Case exp[b][/b]ression was true")
    Case $var2 = "test"
        MsgBox(0, "", "Second Case exp[b][/b]ression was true")
    Case Else
        MsgBox(0, "", "No preceding case was true!")
EndSelect

---------------------------

AutoIt Error

---------------------------

Line 2 (File "E:\Programs\AutoIt3\Examples\june4\game_command4.au3"):

Case $var = 1

Case ^ ERROR

Error: Variable used without being declared.

Link to comment
Share on other sites

Thats right out of the help file . I didn't make it or change it .

Should it not run if it is anĀ  example ?

All example in this section you are refering are to illustrate coding not to be run as is.

Usually the ones in the Function reference run except doc error.

Link to comment
Share on other sites

if you'd like to try something that would actually run based on that.. I did something here for you..

$var = InputBox("Computer Yesman", "do you like Apples?", "", "")

Select
   Case $var = "no"
       MsgBox(0, "", "I don't like them either")
   Case $var = "yes"
       MsgBox(0, "", "Oh yeah.. aren't they awesome?")
   Case Else
       MsgBox(0, "", "make up your mind!")
EndSelect

it should illustrate how cases are being used.

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...