473,406 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Perl loops should use break, not last

Probably been mentioned before but I fail to see why Perl changed the
'break' keyword to 'last', in loops. Bear with me on this - it seems
semantically more accurate to say 'break' - you're immediately breaking out
of the loop. 'last' makes it sound like the current loop will be the last,
but not that the execution should be stopped immediately, whereas break
makes it sound like the latter.

Where can I propose that this be changed, or break aliased to last, for Perl
6?
--
Best regards,
Jeremy Morton (Jez)
Jul 19 '05 #1
1 120118
Jeremy Morton wrote:
Bear with me on this - it seems
semantically more accurate to say 'break' - you're immediately breaking out
of the loop. 'last' makes it sound like the current loop will be the last,


The semantics of 'break' or 'last' are defined by the language (in this
case Perl), not by you.

Why not think of 'last' as "this is the last statement to run for the
loop".

It's always struck me as odd that the 'continue' statement in 'C'
starts the next pass of a loop. This is definitely a strange use of the
concept of "continue". But it is the semantics of 'C', so I accept it.
By trying to map particular programming concepts into single English words
with exisiting meaning there is always going to be some sort of mismatching
oddity.
--
Just because I've written it doesn't mean that
either you or I have to believe it.
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Oleg Leschov | last post by:
Could there be means of exiting nested loops in python? something similar to labelled loops in perl.. I consider it irrating to have to make a flag for sole purpose of checking it after loop if...
46
by: Reinhold Birkenfeld | last post by:
Hello, another Perl/Python question: the subject says it all. Perl is going to change dramatically to become a more powerful and easier to (read|write) language. Is Python taking a similar...
41
by: Xah Lee | last post by:
here's another interesting algorithmic exercise, again from part of a larger program in the previous series. Here's the original Perl documentation: =pod merge($pairings) takes a list of...
2
by: bobmct | last post by:
In a multiple nested structure I have a section that when true need to break out of not only the current structure, but several more to read a much higher level. In perl I would name/label my...
6
by: Wijaya Edward | last post by:
Can we make loops control in Python? What I mean is that whether we can control which loops to exit/skip at the given scope. For example in Perl we can do something like: OUT: foreach my $s1...
15
by: eight02645999 | last post by:
hi, how can i skip printing the last line using loops (for /while) eg for line in open("file): print line. I want to skip printing last line of the file.thanks
3
by: hakiran | last post by:
Hello all, I have been using Perl DBI the last 6months or so. I use it extensively with MySQL. But recently i tried to access Oracle DB with it and was having trouble. Any help would be...
4
crystal2005
by: crystal2005 | last post by:
Hello guys.... I'm newbie in Perl Language. So, in here i would like to ask several questions about Perl itself and not about the coding. I have been given a task to use Perl for directory...
1
by: Smokeho | last post by:
I've been searching for an answer to this for a long time, but found absolutely nothing. Obviously some AJAX has to be used, possibly setting some session variables, but everything I've tried has...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.