Why continue is not allowed outside iteration statements

David-Sarah Hopwood david.hopwood at industrial-designers.co.uk
Tue Nov 25 21:00:46 PST 2008


Michael Day wrote:
> Why is break allowed outside of iteration statements, but not continue?

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

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.

-- 
David-Sarah Hopwood



More information about the Es-discuss mailing list