You do realize that `next` immediately stops the current iteration and
goes onto the *next* one right?
That is, there is no point putting any code after it because it will
never be run.

On Tue, May 23, 2017 at 11:30 PM, ToddAndMargo <toddandma...@zoho.com> wrote:
> Hi All,
>
> I have a test code in progress and I haven't figured out
> how to get 'next' to work the way I want.
>
>     next if $Line.contains( "TASK type" );
>
> works, but
>
>     if $Line.contains( "TASK type" ) {
>        next;
>
> does not.
>
> What am I missing?
>
> Many thanks,
> -T
> yes I know I still have some things to fix on it.
>
>
> <code>
> #!/usr/bin/env perl6
>
> use strict;
>
> my @Data = '<TASK type="D">Mission D',
>            '   <NAME type="P">Sol Wheat</NAME>',
>            '   <NAME type="P">Ted Moon</NAME>',
>            '</TASK>';
> # for @Data -> $Line { say "$Line"; }
>
> for @Data -> $Line {
>    # next if $Line.contains( "TASK type" );
>    if $Line.contains( "TASK type" ) {
>       next;
>       my $Name = $Line;
>       if $Name.contains( "NAME type" ) {
>          $Name ~~ s/.*?\>//;
>          $Name ~~ s/\<.*//;
>          say $Name;
>       }
>    }
> }
>
> </code>
>
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Computers are like air conditioners.
> They malfunction when you open windows
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to