Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   Bug in MEL (https://simplymaya.com/forum/showthread.php?t=9336)

kbrown 09-12-2003 08:19 AM

Possible bug in MEL
 
I've posted this to couple of other forums too.

What am I doing wrong or is there a bug in the switch statement?
Code:

{
    int $a = -5;

    switch($a)
    {
    case -5:
        print("$a was -5\n");
        break;
    default:
        print("$a was some other number\n");
    }
}

The above yields to an error message while it shouldn't:
Code:

// Error:      case -5:
//
// Error: Line 6.11: Syntax error //
// Error:      default:
//
// Error: Line 9.12: Syntax error //
// Error: }; //
// Error: Line 12.1: Syntax error //

It seems like you can't use negative values in a case... :saywhat:

case (-5): doesn't work either...

Pony 09-12-2003 09:27 AM

Hopefully someday soon I will know enufe about mel to give some kind of responce.. sorry ATM..

kbrown 09-12-2003 02:26 PM

No worries, Pony. I am 99.9% sure that this is a bug. I found a workaround though. The trick is to convert the test variable into a string:
Code:

{
  int $a = -5;
  string $b = $a;

  switch($b)
  {
  case "-5":
        print("\n$a was -5\n");
        break;
  default:
        print("\n$a was some other number\n");
  }
}


kbrown 10-12-2003 09:27 AM

Yup, it's a bug. Confirmed by an Alias software developer. Since there is a workaround (see above), it's a low priority bug...

Pony 10-12-2003 12:16 PM

I still think they should give you something for finding it.. even if your not the first.. er.. at least a darn cookie !!

kbrown 10-12-2003 03:00 PM

Hehe... Yeah, I could send them a list of demands :D

- A Quadro FX 3000 card
- A Lamborchini
- A nice and peaceful house near the ocean
- 100 cases of beer

:D

cavalt 10-12-2003 03:26 PM

100 CASES OF BEER!!!!!




Kbrown, we gotta talk.
100 cases of beer is nothing.


10 000 cases of beer!!! Now that's more like it!! He. He.

:beer:

kbrown 10-12-2003 05:22 PM

I forgot to mention... 100 cases per week :D

:beer:

Pony 10-12-2003 09:24 PM

thats a lot of bear.. oh oh.. never mind I see you plan on having partys and inviting Kevin..LOL

kbrown 10-12-2003 09:54 PM

:D


All times are GMT. The time now is 02:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018