Comments

Describing what a piece of code does is an important programming practice. It helps other developers understand your code, and it also helps you when go back to work on your own code sometime later. You can comment a piece of code by typing the comment symbol ' and then writing your comments. The compiler simply ignores comments, so they do not affect performances at all. You can write comments on multiple lines, each starting with the comment symbol. The following code provides an example:

'The following code writes something
'to the Console window
Sub DoSomething()
    Console.WriteLine("Doing something")
End Sub


Different Types of Comments

You can use the REM keyword for commenting code, instead of the ' comment symbol, but that is not recommended as it is really just maintained for backward compatibility with older versions of the language. Visual Basic 2015 introduces support for comments after the implicit line continuation, described shortly, which basically allows you to add comments in scenarios like LINQ queries or array literals.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.14.132