<  Day Day Up  >  

Statements perform the main actions of a program, such as looping over statements. In the next chapter, we'll discuss how a program can handle errors and other exceptional situations in a program when they occur.

Here are some style points to consider.

  • In general, it is a good idea to explicitly declare the types of variables. Besides making it easy to see with a glance what type variables are, it produces faster code because the compiler can know at compile time what type a variable is. The Option Strict statement at the beginning of a source file requires that all variable declarations have an explicit type.

  • Type characters on variables are supported purely for historical reasons, and their use is discouraged.

  • It is highly recommended that Option Explicit always be specified. It is very easy to misspell a variable name and implicitly create a local by accident !

  • Closing more than one For loop with a single Next statement is generally discouraged, because it tends to be less readable.

  • Numbers can also be used as labels, but this functionality is included for historical reasons and is not encouraged.

  • The GoSub statement and the computed forms of the GoTo and GoSub statements ( On...GoTo and On...GoSub ) are no longer supported.

  • Because it is easy to forget to remove Stop statements from source code, setting breakpoints in the debugger is usually preferable to using Stop statements.

 <  Day Day Up  >  

The Visual Basic .NET Programming Language
The Visual Basic .NET Programming Language
ISBN: 0321169514
EAN: 2147483647
Year: 2004
Pages: 173
Authors: Paul Vick

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: