develooper Front page | perl.perl6.language.flow | Postings from August 2000

Re: The distinction between "do BLOCK while COND" and "EXPR while COND" should go

From:
Jonathan Scott Duff
Date:
August 31, 2000 11:47
Subject:
Re: The distinction between "do BLOCK while COND" and "EXPR while COND" should go
Message ID:
20000831134747.B27415@cbi.tamucc.edu
On Thu, Aug 31, 2000 at 01:26:26PM -0500, Christopher J. Madsen wrote:
> I too would like to see last, next, & redo work with do loops.

*Only* do loops or do blocks in general?  And what should they do?

	do { ... last; ... };		# exit the block immediately
	do { ... next; ... };		# equivalent to last?
	do { ... redo; ... };		# equivalent to last?

These fall right in line with the proposal that the "do" be optional
since we can already do these:

	{ ... last; ... }
	{ ... next; ... }
	{ ... redo; ... }

And what about continue blocks?  We can attach them to bare blocks,
but not to do blocks?  That's weird.

> However, I really don't want to see 'return' become a kind of 'last'
> for do{}.  How would I return from a subroutine from within a do loop?

Indeed.

-Scott
-- 
Jonathan Scott Duff
duff@cbi.tamucc.edu



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About