c# - Why does code with multiple semicolons compile? -


i curious know why allowed.

int i=0;; 

i accidentaly typed that. program compiled. noticed after many days have typed ;;

after tried different symbols ~, !, : etc etc

why not allowed first 1 allowed.

just curious know.

you have typed empty statement:

int i=0; // that's 1 statement ; // that's 

it's legal statement in c# have no body.

from section 8.3 of c# language specification:

an empty-statement nothing.

empty-statement:
;
empty statement used when there no operations perform in context statement required.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -