How can I return context sensitive return values in Perl 6?

Viewed 434

In the summary of differences between Perl 5 and Perl 6, it is noted that the wantarray function is gone:

wantarray() is gone

wantarray is gone. In Perl 6, context flows outwards, which means that a routine does not know which context it is in.

Instead you should return objects that do the right thing in every context.

Could someone provide an example of how such an object is created?

2 Answers
Related