A keyword is a reserved word with special meanings in the compiler, whose meaning cannot be changed. Therefore, these keywords cannot be used as an identifier in VB.NET programming such as class name, variable, function, module, etc.
In this section, we will understand about the VB.NET identifier, VB.NET comment, and how we can use it in VB.NET.
There are following reserved keyword available in the VB.NET language.
Let's create a program to find the area and perimeter of a rectangle in VB.NET.
Length is: 5 Breadth is: 6 Area of Rectangle is: 30 Perimeter of Rectangle is: 22 Press any key to exit...
As the name defines, an identifier is used to identify the name of variable, function, class, or any other user-defined elements in the program. An identifier should be the combination of letter, digit, and underscore. Still, the first character of the identifier or variable name should start with alphabet letter or underscore (_) of any length.
There are various rules for identifier in VB.NET, as follows:
Generally, identifiers are meaningful names. Some valid identifiers are:
Value, a, rec1, my_data, Marks, num, etc.
Some invalid identifiers are:
5be : First character should be alphabets or underscore (_)
Class, Shared : Keyword are not allowed as identifier name.
A# - : Identifier does not contain any special symbol.
Avg marks : It should not contain any blank space.
Let's compile and execute the above program.
Hello friends... Nice to meet you... press any key to exit...
A comment is used to explain the various steps that we have taken in our programming. The compiler ignores these comment statements because the compiler is not executed or processed in VB.NET. Therefore, it does not take any place in your compilation code.
In VB.NET, we use ( ' ) symbol to comment a statement.
Now compile and execute the above program.
Radius is: 10 Circumference of Circle: 62.8 press any key to exit...
Hence, it is the best way to explain every step of VB.NET programming language.