exercise: Grains version: 1 plan: 13 imports: '&grains-on-square &total-grains' tests: |- for @($c-data[0]) { if . == -1 { throws-like { grains-on-square(.) }, Exception, .; } else { is grains-on-square(.), |.; } } is total-grains, |$c-data[1]; unit: module example: |- sub grains-on-square ($number) is export { die if $number < 1 or $number > 64; 2**($number-1); } sub total-grains is export { my Int $total; for 1..64 { $total += grains-on-square($_) } $total; }