Sunday, October 20, 2019 13:42

Semicolon character

If you look backwards to the few lessons we had so far, you will notice that we used a lot the semicolon character. This character has a special and important meaning in C#.

As you already know, a program is composed by a list of instructions that perform some actions. When you code these instructions, using the semicolon character tells the compiler to separate these instructions. As you will see, there will be cases when writing a long line of code will not fit on a single line. When the compiler examines you program, it uses the semicolon character to distinguish between one instruction and another.

If you omit using this character, you will be presented with a syntax error and your program will not compile.

Looking at above code, you will notice that our main method has a block of code composed of two instructions, ending with the semicolon character.

Comments

comments

Tags:

Leave a Reply