"michael.steven86" <[EMAIL PROTECTED]> wrote:
>
> Hi everyone,
> 
> I'm experiencing a problem with a multiple if statement.
> I have tried to use braces, but I must be doing
> something wrong.

It's good to see a newbie admit their own mistakes rather
an ask if it's a compiler bug! :-)

> So, I have removed all braces in the pseudo-code below,
> in the hope that someone can help point out where I am
> going wrong: 

It's probably missing braces that are the problem.
The real code would be better. [Or a small version
that exhibits the problem.]

>   if (condition 1) 
>      calc1 
>   else if (condition 2) 
>      calc2 
>   else if (condition 3) 
>      calc3 
>   else if (condition 4) 
>      calc4 
>   else 
>      calc5 
> 
> I get 2 error messages stating that I have misplaces else
> statements after calc3 and calc4. 

I'm guessing calc3 has two or more statements not enclosed
by braces...

  ...
  else if (cond)
    do_x;
    do_y;
  else if (nother) /* misplaced else */

> If any one of the conditions are met, I also want to
> exit the program - would "break" be suitable for this? 

No, but you have already named a candidate function. ;)

-- 
Peter

Reply via email to