Justin Collins a écrit :
This works:

switch 0 {
    -1 => "minus one"
    1 => "one"
}


This doesn't work:

switch 0 {
    1 => "one"
    -1 => "minus one"
}


Output:

switch.neko(3): Unexpected =>

It appears to have something to do with the position of the negative number.

Yes, this is because it starts parsing "one" - 1
Sadly, adding a ; after "one" is not allowed right now by Neko syntax, so one way to work with it is the following :

switch 0 {
  1 => "one"
  { -1; } => "minus one"
}

Nicolas

--
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to