2010/02/17

C# week4_1

15/02/2010

 
 

const: Constant (When you don't want to change the value, it will be used.)

block: { - block- }

 
 

Scope and lifetime of variables

{

int i = 5; //It only use in this block.

}

 
 

Nested scope

{

int i = 10;

{

}

//"i" can be used here

}

 
 

Example

{

int i = 10;

{

int i = 15;

}

Console.WriteLine(i);

}

Result: error

0 件のコメント:

コメントを投稿

UA-9417263-1