Hello,

> >   sub foo ( Int $x ) { 0 if $x > 5 }
> >   sub hello {say "hello $^world"}
> >   if defined my $value = foo 45 { hello $value }
>    with foo 7 { say $^value }

i feel really dumb right now as i just used with and didn't made the
match in my head.

> or if you want to trigger on *not* defined:
>    without foo 7 { say $^value }

hoo ...

    my $x;
    without $x { note '$x is not set' }
    if not defined $x { note '$x is not set' }
    $x = 34;
    without $x { note 'is your raku broken?' }

very nice! thank you for sharing!

> You can use the » without fear if there aren't any side-effects.
> Consider this:
>    class Foo {
>        my int $seen = 0;
>        method bar() { ++$seen }  # side-effect
>    }
…
> Another thing to remember is the order in which they are executed:
>    ("a".."z")».&say;
…
> Hope this explains :-)

Both are clear and i AFAIR, i realize that your second example
illustrate the error i made as i was writing stuff in $*STDOUT.

thank you so much!
marc

Reply via email to