RosettaCodeData/Task/Variables/Perl-6/variables-2.pl6

7 lines
387 B
Raku
Raw Permalink Normal View History

2015-11-18 06:14:39 +00:00
say ++$; # this is an anonymous state variable
say ++$; # this is a different anonymous state variable, prefix:<++> forces it into numerical context and defaults it to 0
2018-06-22 20:57:24 +00:00
say $+=2 for 1..10; # here we do something useful with another anonymous variable
2013-04-11 01:07:29 -07:00
2015-11-18 06:14:39 +00:00
sub foo { $^a * $^b } # for positional arguments we often can't be bothered to declare them or to give them fancy names
say foo 3, 4;