John Coppens wrote: > On Wed, 26 Aug 2009 12:51:34 -0400 > Byron Jeff wrote: > >> Continues and breaks only work within certain constructs. > > Ok... The break would have taken you out of a for, if the if statement > were inside a for: Of course -- the 'break' is still inside a 'for' statement, if the 'if' statement is inside a 'for' statement. But if you textually replace "while" with "if", you can't guarantee that the ex-'while'-now-'if' statement is enclosed in a statement that makes the 'break' -- which previously was legal in the ex-'while' statement -- to still be legal. > This is, of course, not an example of elegant programming, but could > explain why the 'break' worked. It is quite common to have the 'break' statements that are inside loops inside 'if/else' constructs. Unconditional 'break' statements inside loops are the exception (and usually not an example of elegant programming :) Gerhard -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist