oops make that 

last if !someCondition();

--
Mark Biggar
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

 -------------- Original message ----------------------
From: [EMAIL PROTECTED]
> loop {
>     doSomething();
> next if someCondition();
>     doSomethingElse();
> }
> 
> --
> Mark Biggar
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> 
>  -------------- Original message ----------------------
> From: "Mark J. Reed" <[EMAIL PROTECTED]>
> > OK, so let's look at the general problem.  The structure is this:
> > 
> > doSomething();
> > while (someCondition())
> > {
> >     doSomethingElse();
> >     doSomething();
> > }
> > 
> > ...and you want to factor out the doSomething() call so that it only
> > has to be specified once.
> > 
> > Is that correct, Aristotle?
> > 
> > The "gotcha" is that the first doSomething() is unconditional, while
> > the first doSomethingElse() should only happen if the loop condition
> > is met (which means just moving the test to the end of the block
> > doesn't solve the problem).
> > 
> > IFF the doSomething() can be reasonably combined with the conditional
> > test, then Bruce's solution works, but that won't necessarily be the
> > case in general.  Overall, the goal is to ensure that by the end of
> > the loop the program is in the state of having just called
> > doSomething(), whether the loop runs or not - while also ensuring that
> > the program is in that state at the top of each loop iteration.
> > 
> > It does seem like a closure trait sort of thing, but I don't think
> > it's currently provided by the p6 spec.
> 

Reply via email to