item
ErrorsCollection

item

Synthesised documentation from type/Any type/Mu

From type/Any

See Original text in context

multi item(\x)
multi item(|c)
multi item(Mu $a)

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"␤»

From type/Mu

See Original text in context

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"␤»