This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Playground { | |
class Program { | |
static void Main() { | |
int a = 30; | |
for ( int i = 0; i < 10; i++ ) { | |
int a = 9; // 編譯錯誤,無法在此範圍宣告名為 a 的區域變數與參數,因為 a 這個名稱已經在這裡以上的區塊被使用了 | |
Console.Write( a + i ); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment