Re: *Why* does this work?
It works because the code editor is buggy and displays something different to what is actually there i.e. what the programmer sees is not what the compiler sees.
The cause of the behaviour is probably because it is using a standard text editing class and this bit of the behaviour is designed for a word processor and it hasn't been blocked or modified.
An analogy might be if a code editor were to allow white-on-white formatting, like a word processor, and that were used to sneak code into a program in the guise of a few blank lines.