πŸ“˜ Prefix operator ^ in Perl 6

^ is a range-creating operator or the so-called upto operator. It creates a range (which is an object of the Range type) from 0 up to the given value (not including it).

.print for ^5; # 01234

This code is equivalent to the following, where both ends of the range are explicitly specified:

.print for 0..4; # 01234

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s