@@ -351,8 +351,8 @@ not interpolate:
351
351
352
352
= begin code
353
353
my $names = 'things';
354
- say 'Do not call me $names'; # Do not call me $names
355
- say "Do not call me $names"; # Do not call me things
354
+ say 'Do not call me $names'; # OUTPUT: « Do not call me $names»
355
+ say "Do not call me $names"; # OUTPUT: « Do not call me things»
356
356
= end code
357
357
358
358
Double quoted strings in Perl 6 can interpolate variables with the C < $ >
@@ -375,11 +375,11 @@ When you put words in between the < and > they are all assumed to be strings,
375
375
so you do not need to wrap them each in double quotes C << "..." >> .
376
376
377
377
= begin code :preamble<my %sets>
378
- say "Math: { 1 + 2 }"; # Math: 3
378
+ say "Math: { 1 + 2 }"; # OUTPUT: « Math: 3»
379
379
my @people = <Luke Matthew Mark>;
380
- say "The synoptics are: {@people}"; # The synoptics are: Luke Matthew Mark
380
+ say "The synoptics are: {@people}"; # OUTPUT: « The synoptics are: Luke Matthew Mark»
381
381
382
- say "{%sets}"; # From the table tennis tournament
382
+ say "{%sets}"; # From the table tennis tournament
383
383
384
384
# Charlie 4
385
385
# Dave 6
@@ -399,17 +399,17 @@ the postcircumfix.
399
399
= begin code
400
400
my @flavours = <vanilla peach>;
401
401
402
- say "we have @flavours"; # we have @flavours
403
- say "we have @flavours[0]"; # we have vanilla
402
+ say "we have @flavours"; # OUTPUT: « we have @flavours»
403
+ say "we have @flavours[0]"; # OUTPUT: « we have vanilla»
404
404
# so-called "Zen slice"
405
- say "we have @flavours[]"; # we have vanilla peach
405
+ say "we have @flavours[]"; # OUTPUT: « we have vanilla peach»
406
406
407
407
# method calls ending in postcircumfix
408
- say "we have @flavours.sort()"; # we have peach vanilla
408
+ say "we have @flavours.sort()"; # OUTPUT: « we have peach vanilla»
409
409
410
410
# chained method calls:
411
411
say "we have @flavours.sort.join(', ')";
412
- # we have peach, vanilla
412
+ # OUTPUT: « we have peach, vanilla»
413
413
= end code
414
414
415
415
0 commit comments