Re: New Switch Idea

new topic     » goto parent     » topic index » view thread      » older message » newer message

My proposal:

select value do 
  case 1, 2, 3, 5..78: doA() 
  case 6, 99: doB() 
  else doC() 
end select 
 
switch value do 
  case 1, 2, 3, 5..78: doA() 
  case 6, 99: doB() 
  else doC() 
end switch 

The only difference between "switch" and "select" is that "switch" falls through, "select" does not. To avoid a fallthrough inside a "switch" a "break" statement could be allowed. Personally, I would omit "switch" completely as it is not often needed and confusing, especially since EU also targets hobby programmers. But I included it in my proposal because others want the feature.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu