Why continue is not allowed outside iteration statements

Michael Day mikeday at yeslogic.com
Tue Nov 25 21:08:57 PST 2008

> Perhaps because 'continue' would implicitly create an iteration, when no
> iteration construct is apparent in the source code.

A reasonable response :)

> That would violate the principle advocated by Dijkstra in
> 'A Case Against the GO TO Statement'
> <http://www.cs.utexas.edu/~EWD/transcriptions/EWD02xx/EWD215.html>, since
> the start of every block (not even just every labelled block) would be a
> possible jump target, with no explicit indication that you need to keep
> track of the number of iterations of the block in order to describe the
> progress of that function execution.

The start of every block? Why not just the start of labelled blocks? 
(Assuming that continue outside of an iteration statement would require 
a target label, just as break currently requires a target label when 
used outside of an iteration statement).

Currently the end of every labelled block is a possible jump target, and 
it seems that the language could be simplified if break was not allowed 
outside of iteration statements. But code might already depend on this.



Print XML with Prince!

More information about the Es-discuss mailing list