# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #115598]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=115598 >


<brrt> basically, 'take' both yields its value and returns, right?
<brrt> so my $x = take 3; sets $x to 3?
<brrt> r: my $x = take 3; say $x;
<masak> r: my @a = gather { say take 3 };
<p6eval> rakudo 64208d: OUTPUT«0␤»
<masak> brrt: that's interesting.
<masak> what does the 0 mean?
<masak> r: my @a = gather { say take 3; say take 42 };
<p6eval> rakudo 64208d: OUTPUT«0␤0␤»
<masak> n: my @ = gather { say take 3; say take 42 };
<p6eval> niecza v22-16-g4c016f5: OUTPUT«3␤42␤»
* masak submits rakudobug
<flussence> take returns 0?
<flussence> (sometimes?)
<masak> flussence: in Rakudo, yes. in Niecza it gives back the value.
<masak> which seems much more useful.
<flussence> agreed
<brrt> masak: returning the value is basically what is spec'-ed
<masak> S04:735.
<masak> The value returned by the C<take> to the C<take>'s own context
is that same
<masak> returned argument (which is ignored when the C<take> is in
sink context).

Reply via email to