Jump to content
Sign in to follow this  
nikink

Switch not working...?

Recommended Posts

nikink

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?

Share this post


Link to post
Share on other sites
nikink
Ah! Something so simple! Thanks. How do I notify the folks in charge of the helpfile?

Share this post


Link to post
Share on other sites
GaryFrost

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.

 

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.