File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -525,7 +525,6 @@ is returned by using features which explicitly set the top-level capture.
525
525
526
526
Defined as:
527
527
528
- multi method lines(Str:D: :$count!)
529
528
multi method lines(Str:D: $limit)
530
529
multi method lines(Str:D:)
531
530
@@ -539,21 +538,20 @@ Examples:
539
538
say "a\nb".lines.elems; # OUTPUT: «2»
540
539
say "a\n".lines.elems; # OUTPUT: «1»
541
540
542
- The first multi in the definition above just counts the number of lines if
543
- C < count > is true.
541
+ You can limit the
542
+ number of lines returned by setting the C < $limit > variable to a non-zero,
543
+ non-C < Infinity > value:
544
544
545
- say <not there yet>.join("\n").lines( :count ); # OUTPUT: «3 »
545
+ say <not there yet>.join("\n").lines( 2 ); # OUTPUT: «(not there) »
546
546
547
- However, this feature might be deprecated in the near future; you can always
548
- use :
547
+ B « DEPRECATED as of C < 6.d > language » , the C < :count > argument can be used
548
+ to return the total number of lines :
549
549
550
- say <not there yet>.join("\n").lines.elems ; # OUTPUT: «3»
550
+ say <not there yet>.join("\n").lines( :count ) ; # OUTPUT: «3»
551
551
552
- You can also limit the
553
- number of lines returned by setting the C < $limit > variable to a non-zero,
554
- non-C < Infinity > value:
552
+ Use L < elems > call on the returned L < Seq > instead:
555
553
556
- say <not there yet>.join("\n").lines( 2 ) ; # OUTPUT: «(not there) »
554
+ say <not there yet>.join("\n").lines.elems ; # OUTPUT: «3 »
557
555
558
556
= head2 routine words
559
557
You can’t perform that action at this time.
0 commit comments