Skip to content

Commit 3cc2c00

Browse files
Nigel-Ecmajskeet
authored andcommitted
Oops, grammar rule *local_variable_type* removed by this edit is used by *foreach_statement*. This may point to a revision
being required there but it has just been added to §13.9.5 where it is used. So this PR now impacts 2 clauses…
1 parent 2d86b34 commit 3cc2c00

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

standard/statements.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,6 @@ implicitly_typed_local_variable_declarator
366366
367367
An *implicity_typed_local_variable_declaration* introduces a single local variable, *identifier*. The *expression* or *variable_reference* must have a compile-time type, `T`. The first variant declares a variable with type `T` and an initial value of *expression*. The second variant declares a ref variable with type `ref T` and an initial value of `ref` *variable_reference*.
368368

369-
370369
> *Example*:
371370
>
372371
> <!-- Example: {template:"code-in-main", name:"LocalVariableDecls4", expectedWarnings:["CS0219","CS0219"], additionalFiles:["Order.cs"]} -->
@@ -1098,6 +1097,11 @@ foreach_statement
10981097
: 'foreach' '(' ref_kind? local_variable_type identifier 'in'
10991098
expression ')' embedded_statement
11001099
;
1100+
1101+
local_variable_type
1102+
: type
1103+
| 'var'
1104+
;
11011105
```
11021106

11031107
The *local_variable_type* and *identifier* of a foreach statement declare the ***iteration variable*** of the statement. If the `var` identifier is given as the *local_variable_type*, and no type named `var` is in scope, the iteration variable is said to be an ***implicitly typed iteration variable***, and its type is taken to be the element type of the `foreach` statement, as specified below.

0 commit comments

Comments
 (0)