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
Post a Comment