Simple syntax question that couldnt be answered with the reference site

If i have a while-loop and inside an if-loop like this

while(x)

{
if()
{
break;
}
}

will the break function exit out of both the while and loop? or only the if loop? if not how can i do so?

I cant test this right now since the whole program isnt ready for testing yet and there is no real way to find out.

void setup ()
{
  Serial.begin (9600);
  int x = 1;
  int y = 2;
  while(x)
  {
    if(y == 2)
    {
      break;
    }
    Serial.println ("I'm here");
  }
  Serial.println ("I broke out");
}

void loop ()
{}

What do you mean you can't test it?

AWOL:
What do you mean you can't test it?

ok, i feel like an idiot now, im sorry.

will the break function exit out of both the while and loop? or only the if loop?

It's an if STATEMENT not an if LOOP. There is ONLY one loop (the while statement DOES loop) to break out of.

dangomango:
If i have a while-loop and inside an if-loop like this

But your "if-loop" is INSIDE your while loop.

BTW This thread is not the first time I've seen someone use the expression "if loop". Where does this nonsense come from?

Does this not help?

http://arduino.cc/en/Reference/Break

"break is used to exit from a do, for, or while loop, bypassing the normal loop condition. It is also used to exit from a switch statement."

If those statements are nested it breaks out of the innermost loop/switch containing the break;