diff --git a/doc/Language/control.pod b/doc/Language/control.pod index c84b6006c..d8ac78f72 100644 --- a/doc/Language/control.pod +++ b/doc/Language/control.pod @@ -4,7 +4,7 @@ =SUBTITLE Statements used to control the flow of execution -=head2 blocks +=head2 X Like many languages, Perl6 uses C delimited by C<{> and C<}> to compartmentalize code. When a block stands alone as a statement, @@ -48,7 +48,7 @@ You have to watch out for this in most languages anyway to prevent things from getting accidentally commented out. Many of the examples below may have unnecessary semicolons for clarity. -=head2 do +=head2 X The simplest way to run a block where it cannot be a stand-alone statement is by writing C before it: @@ -138,7 +138,7 @@ for it more strongly: $_ = 1; if 42 -> $a { $_.say; $a.say } ; # says "1" then says "42" $_ = 1; if 42 { $_.say; $^a.say } ; # says "1" then says "42" -=head3 else/elsif +=head3 X A compound conditional may be produced by following an C conditional with C to provide an alternative block to run when the conditional @@ -213,7 +213,7 @@ what the C sees, since it was the last one tried: if False { } elsif 0 { } else -> $a { $a.say } ; # says "0" -=head3 unless +=head3 X When you get sick of typing "if not (X)" you may use C to invert the sense of a conditional statement. You cannot use C or C @@ -238,7 +238,7 @@ two differences C works the same as L: Implementation note: Currently, Rakudo will say "1 Nil 3 0" for the last example because it is not caught up to this part of the design yet. -=head3 with, orwith, without +=head3 X The C statement is like C but tests for definedness rather than truth. In addition, it topicalizes on the condition, much like C: @@ -264,7 +264,7 @@ There are also C and C statement modifiers: return 42 with $answer; .throw without $answer; -=head2 for +=head2 X The C loop iterates over a list. @@ -310,7 +310,7 @@ for @cars <-> $_ {...} =end code -=head2 gather/take +=head2 X C is a statement or block prefix that returns a L of values. The values come from calls to C in the dynamic scope of the C block. @@ -360,7 +360,7 @@ from within C: say weird(, :direction ); # (c b a) -=head2 given +=head2 X The C statement is Perl 6's topicalizing keyword in a similar way that C topicalizes in languages such as C. In other words, C @@ -382,7 +382,7 @@ This is a lot more understandable than: { .say; .Numeric; }(EXPR) -=head3 default and when +=head3 X A block containing a C statement will be left immediately when the sub-block after the C statement is left. It is @@ -418,7 +418,7 @@ C statements. The following code says C<"Int"> not C<42>. } #-> Int -=head3 proceed and succeed +=head3 X Both C and C are meant to be used only from inside C or C blocks. @@ -480,7 +480,7 @@ specify a final value for the block. } #-> Int -=head2 loop +=head2 X The C statement is the C-style C loop in disguise: @@ -498,7 +498,7 @@ is equivalent to the C-ish idiom: loop (;;) {...} -=head2 while, until +=head2 X The C statement executes the block as long as its condition is true. So @@ -556,7 +556,7 @@ $x++ while $x < 12 Also see C and C below. -=head2 repeat/while, repeat/until +=head2 X Perl 5 allows one to apply a statement modifier to a C block such that C-like constructs such as @@ -580,11 +580,7 @@ This can also be written quite naturally with C: ... } until $x >= 10; -=head2 while - -=comment TODO - -=head2 return +=head2 X =comment TODO @@ -602,7 +598,7 @@ LINE: for $*IN.lines -> $line { =end code -=head2 next +=head2 X The C command starts the next iteration of the loop. So the code @@ -618,7 +614,7 @@ my @x = 1, 2, 3, 4, 5; prints "1245". -=head2 last +=head2 X The C command immediately exits the loop in question. @@ -634,7 +630,7 @@ for @x -> $x { prints "12". -=head2 redo +=head2 X The C command restarts the loop block without evaluating the conditional again. @@ -645,7 +641,7 @@ conditional again. =end code -=head2 goto +=head2 X =comment TODO diff --git a/htmlify.p6 b/htmlify.p6 index 41d6f01cf..c3eedb364 100755 --- a/htmlify.p6 +++ b/htmlify.p6 @@ -378,6 +378,8 @@ sub find-definitions (:$pod, :$origin, :$min-level = -1, :$url) { my $fc := .[1]; proceed unless $fc.type eq "X"; @definitions = $fc.meta[0].flat; + # set default name if none provide so X gets name 'if' + @definitions[1] = $fc.contents[0] if @definitions == 1; $unambiguous = True; } when :(Str $ where /^The \s \S+ \s \w+$/) {