Nathan-Wall / proto

A programming language derived from JavaScript which emphasizes prototypes, integrity, and syntax.
Other
12 stars 1 forks source link

Document comma separated cases #56

Open Nathan-Wall opened 10 years ago

Nathan-Wall commented 10 years ago

case statements (in a switch) support comma separated values, to help out when multiple values should be handled the same way (since fall-through isn't implicit and requires continue if separate case statements are used).

The following example logs "bar".

var a = 2;
switch a :{
    case 0: console.log('foo');
    case 1, 2, 3: console.log('bar');
    case 4: console.log('bing');
}