X hits on this document

1076 views

0 shares

0 downloads

0 comments

181 / 396

C# LANGUAGE SPECIFICATION

constant-declarators: constant-declarator constant-declarators   ,   constant-declarator

constant-declarator: identifier   =   constant-expression

The type of a local-constant-declaration specifies the type of the constants introduced by the declaration. The type is followed by a list of constant-declarators, each of which introduces a new constant. A constant-declarator consists of an identifier that names the constant, followed by an “=” token, followed by a constant-expression (§‎7.15) that gives the value of the constant.

The type and constant-expression of a local constant declaration must follow the same rules as those of a constant member declaration (§‎10.3).

The value of a local constant is obtained in an expression using a simple-name (§‎7.5.2).

The scope of a local constant is the block in which the declaration occurs. It is an error to refer to a local constant in a textual position that precedes its constant-declarator. Within the scope of a local constant, it is a compile-time error to declare another local variable or constant with the same name.

A local constant declaration that declares multiple constants is equivalent to multiple declarations of single constants with the same type.

8.6 Expression statements

An expression-statement evaluates a given expression. The value computed by the expression, if any, is discarded.

expression-statement: statement-expression   ;

statement-expression: invocation-expression object-creation-expression assignment post-increment-expression post-decrement-expression pre-increment-expression pre-decrement-expression

Not all expressions are permitted as statements. In particular, expressions such as x + y and x == 1 that merely compute a value (which will be discarded), are not permitted as statements.

Execution of an expression-statement evaluates the contained expression and then transfers control to the end point of the expression-statement. The end point of an expression-statement is reachable if that expression-statement is reachable.

8.7 Selection statements

Selection statements select one of a number of possible statements for execution based on the value of some expression.

selection-statement: if-statement switch-statement

8.7.1 The if statement

The if statement selects a statement for execution based on the value of a boolean expression.

168Copyright Microsoft Corporation 1999-2003. All Rights Reserved.

Document info
Document views1076
Page views1076
Page last viewedSun Dec 11 04:16:59 UTC 2016
Pages396
Paragraphs9401
Words133190

Comments