Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^4: Control Structures

by hossman (Prior)
on May 11, 2005 at 17:25 UTC ( [id://456083]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Control Structures
in thread Control Structures

To be honest, I'm totally lost in what you are saying up to "The best way I know to express the loop-and-a-half is:" ... from there on, I'm with you 100%. and you're right, this...

while (1) { S; last if (B); T; }

...is a perfectly valid way of expressing the construct in Perl(5). But I'd like something:

  • That doesn't require an explict "last" or "goto" inthe condition test
  • that has less neccessary syntactic cruft (ie: the "(1)" on the while, and the "if" in the condition test
  • forces S and T to be seperate scopes -- admitadly, this is just my own personal view on what *seems right* ... other people may not feel hat adds any value

hence my desire to have...

do { S; } while (!B) { T; }

...in perl5, which when S or T are No-Ops, breaks down to either...

do { S; } while (!B); # OR while (!B) { T; }

but the meaning of "do" changes in P6, hence...

loop { S; } while (!B) { T; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://456083]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-26 00:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found