returning a break?

Rui Coelho Justino rmcjustino at gmail.com
Mon Jun 2 12:31:30 PDT 2008


Hello
as I'm starting to learn this great language I've it a wall.
After some analise's I decided to go with a switch case, approach to solve
my problem, so now I have one condition that if met will break the switch,
then how can I create a function the will summarise that check and simply
return a break(case 1), opposed to write on all case's the same code (case
2,3)?

to clarify it:

switch( int_case )
    {
      case 1, 0:
        Stdout( "Print 1" ).newline;
        function_that_breaks ( int_to_verify );
      case 2:
        Stdout( "Print 2" ).newline;
        if ( int_to_verify != 0 )
        {
          break;
        }
      case 3:
        Stdout( "Print 2" ).newline;
        if ( int_to_verify != 0 )
        {
          break;
        }
     }

How should this function be setup?
function_that_breaks ( int )

using "return break;" doesn't work.
Thanks


More information about the Digitalmars-d-learn mailing list