Course of Raku / Advanced / Subroutines / Multiple dispatch / Exercises

Bulk pricing

Problem

Write two multi-subroutines named price that take an integer quantity. Using a where clause, make an order of 10 or more items print bulk price, and a smaller order print normal price.

Call the subroutine for the quantities 3 and 25.

Example

The program prints:

normal price
bulk price

Solution

See the solution

Course navigation

Multiple dispatch   |   Solution: Bulk pricing