Skip to content

Commit 3ae65b2

Browse files
authored
fix/enhance some examples (#632)
Label `LABEL:` is not followed by a statement, and needs to be; null statement added Enhanced 2xdelegate examples, so they are a better fit for the test harness
1 parent 7992405 commit 3ae65b2

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

standard/variables.md

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ finally «finally_block»
458458
> // j definitely assigned
459459
> }
460460
> // i and j definitely assigned
461-
> LABEL:
461+
> LABEL: ;
462462
> // j definitely assigned
463463
> }
464464
> }
@@ -767,14 +767,18 @@ For a *lambda_expression* or *anonymous_method_expression* *expr* with a body (e
767767
> *Example*: The example
768768
>
769769
> ```csharp
770-
> delegate bool Filter(int i);
771-
> void F()
770+
> class A
772771
> {
773-
> int max;
774-
> // Error, max is not definitely assigned
775-
> Filter f = (int n) => n < max;
776-
> max = 5;
777-
> DoWork(f);
772+
> delegate bool Filter(int i);
773+
> void F()
774+
> {
775+
> int max;
776+
> // Error, max is not definitely assigned
777+
> Filter f = (int n) => n < max;
778+
> max = 5;
779+
> DoWork(f);
780+
> }
781+
> void DoWork(Filter f) { ... }
778782
> }
779783
> ```
780784
>
@@ -787,14 +791,17 @@ For a *lambda_expression* or *anonymous_method_expression* *expr* with a body (e
787791
> *Example*: The example
788792
>
789793
> ```csharp
790-
> delegate void D();
791-
> void F()
794+
> class A
792795
> {
793-
> int n;
794-
> D d = () => { n = 1; };
795-
> d();
796-
> // Error, n is not definitely assigned
797-
> Console.WriteLine(n);
796+
> delegate void D();
797+
> void F()
798+
> {
799+
> int n;
800+
> D d = () => { n = 1; };
801+
> d();
802+
> // Error, n is not definitely assigned
803+
> Console.WriteLine(n);
804+
> }
798805
> }
799806
> ```
800807
>

0 commit comments

Comments
 (0)