I'm putting together a Raku presentation for my co-workers and have a
section on state variables. This is my example:
sub how-many {
state $times;
say "You called me {++$times} times";
}
> how-many
You called me 1 times
> how-many
You called me 2 times
> how-many
You called me 3 times
T
> On 26 Oct 2020, at 18:40, Sean McAfee wrote:
> Is this the intended behavior? The doc page on quoting constructs just says
> that values can be interpolated with braces, but (at least to my eyes)
> doesn't suggest that this involves creating a new scope, or a new function,
> or however it is
On Mon, Oct 26, 2020 at 08:04:21PM +0100, Elizabeth Mattijsen wrote:
> > On 26 Oct 2020, at 18:40, Sean McAfee wrote:
> > Is this the intended behavior? The doc page on quoting constructs
> > just says that values can be interpolated with braces, but (at least
> > to my eyes) doesn't suggest th
On Mon, Oct 26, 2020 at 12:04 PM Elizabeth Mattijsen wrote:
> Personally, I would avoid the use of the anonymous state variable. I
> think it is an example where Larry would nowadays apply rule #2.
>
Well, I wouldn't use a construction like that in real code. It just seems
like one of the simp