Jump to content

Switch not working...?


nikink
 Share

Recommended Posts

Using v3.2.0.1

$var = 30

Switch Int($var)
     Case 1 To 10
         MsgBox(0, "Example", "$var was greater than 1")

     Case 11 To 20
         MsgBox(0, "Example", "$var was greater than 10")

     Case 21 To 30
         MsgBox(0, "Example", "$var was greater than 20")

     Case 31 To 40
         MsgBox(0, "Example", "$var was greater than 30")

     Else Case
         MsgBox(0, "Example", "$var was greater than 40 or less r equal to 0")

EndSwitch

Errors out with:

C:\Documents and Settings\nmay\Desktop\Switch-test.au3(16,6) : ERROR: missing EndSwitch.
     Else
~~~~~^
C:\Documents and Settings\nmay\Desktop\Switch-test.au3(3,17) : REF: missing EndSwitch.
Switch Int($var)
~~~~~~~~~~~~~~~~^
C:\Documents and Settings\nmay\Desktop\Switch-test.au3(16,6) : ERROR: syntax error
     Else
~~~~~^
C:\Documents and Settings\nmay\Desktop\Switch-test.au3 - 2 error(s), 0 warning(s)

And that example is copy pasted straight from help files...

What am I missing?

Link to comment
Share on other sites

Ah! Something so simple! Thanks. How do I notify the folks in charge of the helpfile?

why?

here's the example from the help file:

Switch @HOUR
Case 6 To 11
    $msg = "Good Morning"
Case 12 To 17
    $msg = "Good Afternoon"
Case 18 To 21
    $msg = "Good Evening"
Case Else
    $msg = "What are you still doing up?"
EndSwitch
        
MsgBox(0, Default, $msg)

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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