Re: next

2017-06-19 Thread Andy Bach
On Mon, Jun 19, 2017 at 11:35 AM, Brad Gilbert  wrote:

> Instead of a `continue` block after the loop, there is a `NEXT` phaser
> inside the block
>

ah, thanks (though the term "phaser" (outside of "set on stun", of course)
is new) and that can be block too:
https://docs.perl6.org/language/5to6-nutshell.html#Flow_Control_statements

   my $str = '';
for 1..5 {
next if $_ % 2 == 1;
$str ~= $_;
NEXT {
$str ~= ':'
}
}



-- 

a

Andy Bach,
afb...@gmail.com
608 658-1890 cell
608 261-5738 wk


Re: next

2017-06-19 Thread Brad Gilbert
On Mon, Jun 19, 2017 at 11:15 AM, Andy Bach  wrote:
>
> On Fri, Jun 16, 2017 at 11:11 PM, Gabor Szabo  wrote:
>>
>> If the loop has some action and a condition it will jump to  execute
>> the action again (increment $i) and check the condition and act
>> accordingly doing the next iteration or quitting the loop.
>
>
> Just checking but there are no "continue" blocks for loop control stmts
> anymore, P6? Google suggested maybe foreach loops but that was back in 2011.
>

Instead of a `continue` block after the loop, there is a `NEXT` phaser
inside the block

for 1..4 {
  next if $_ == 3;
  .^name.say;

  NEXT .say;
}

Which results in:

Int
1
Int
2
3
Int
4


Re: next

2017-06-19 Thread Andy Bach
On Fri, Jun 16, 2017 at 11:11 PM, Gabor Szabo  wrote:

> If the loop has some action and a condition it will jump to  execute
> the action again (increment $i) and check the condition and act
> accordingly doing the next iteration or quitting the loop.
>

Just checking but there are no "continue" blocks for loop control stmts
anymore, P6? Google suggested maybe foreach loops but that was back in 2011.


-- 

a

Andy Bach,
afb...@gmail.com
608 658-1890 cell
608 261-5738 wk