Jump to content
AndreyS

Please explain the strange result

Recommended Posts

Please explain why the $ y in the first case is equal to 3 and the second 2?  :blink:

How to make the code to work correctly?

Thanks you!

$x = 10.1

Switch $x
    Case 0 To 10
        $y = 1
    Case 11 To 60
        $y = 2
    Case Else
        $y = 3
EndSwitch

MsgBox(0,"false",$y)

$x = 11.1

Switch $x
    Case 0 To 1
        $y = 1
    Case 11 To 60
        $y = 2
    Case Else
        $y = 3
EndSwitch

MsgBox(0,"true",$y)

 

 

Share this post


Link to post
Share on other sites

Understood, JLogan3o13!
Simply, it was a topic that is talked about a simple mistake.
I immediately noticed the obvious. Probably due to the fact that I lost my attention for a long time programming. :D
I would not want to clutter up the forum such errors.

In general, users can delete topics?

Share this post


Link to post
Share on other sites

No, but we tend to leave topics out there for others who may be searching. We've all had the a-HA moment as soon as we post something, but you never know when someone else is going to learn from your post :)

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

×
×
  • Create New...