Re: The fate of Euphoria

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

Patrick Barnes wrote:
> It doesn't exit out of the switch statement until you call break. If
> switch was implemented in Euphoria, I think it would have to do things
> this way, as C/C++ and Java both do things like this, and most
> programmers use one of the three languages.

I don't think that's a good idea. C# (newer than Java) gives a compile-time
error when trying to use a 'case'-statement without a 'break'. Fall-through
isn't supported BECAUSE it caused too many errors.

You can do this:

switch(x)
{
   case 1:
   case 2:
   case 3:
      Console.WriteLine("1, 2 or 3");
      break;
   case 4:
   case 5:
      Console.WriteLine("4 or 5");
      break;
}

But if you leave out the 'break', you won't be able to compile.
Fall-through causes errors, when you forget to 'break' at the right
place.

--
Recycle your pets.
tommy online: http://users.telenet.be/tommycarlier
tommy.blog: http://tommycarlier.blogspot.com

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

Search



Quick Links

User menu

Not signed in.

Misc Menu