Documentation for routine item
assembled from the following pages:
Class: Any §
From Any
(Any) sub item §
Defined as:
multi item(\x)multi item(|c)multi item(Mu )
Forces given object to be evaluated in item context and returns the value of it.
say item([1,2,3]).raku; # OUTPUT: «$[1, 2, 3]» say item( %( apple => 10 ) ).raku; # OUTPUT: «${:apple(10)}» say item("abc").raku; # OUTPUT: «"abc"»
You can also use $
as item contextualizer.
say $[1,2,3].raku; # OUTPUT: «$[1, 2, 3]» say $("abc").raku; # OUTPUT: «"abc"»
Class: Mu §
From Mu
(Mu) method item §
method item(Mu \item:) is raw
Forces the invocant to be evaluated in item context and returns the value of it.
say [1,2,3].item.raku; # OUTPUT: «$[1, 2, 3]» say %( apple => 10 ).item.raku; # OUTPUT: «${:apple(10)}» say "abc".item.raku; # OUTPUT: «"abc"»