Summary


In this hour we looked at Visual Basic's control structures. Control structures alter the program flow from a sequential, one-line-after-the-other model, to one where lines of code can be conditionally executed and can be executed repeatedly until some specified set of criteria is met.

Visual Basic supports conditional control structures through the If statement. The If statement evaluates a condition and, if it is true, executes the instructions following the Then. In addition to the If ... Then portion of an If statement, ElseIf and Else clauses can be included.

Visual Basic has a number of looping constructs, the two most common ones being the For loop and the Do loop. The For loop works with an integer variable that it assigns an initial starting value to. It then executes the loop body, incrementing the looping variable at the end of each execution of the loop body. The For loop executes until the looping variable has surpassed the specified bounds.

The Do loop is more general. Rather than having a looping variable, it simply executes the loop body until a specified condition is met. There are two flavors of Do loop: a Do loop that executes the loop body while the condition is true and a Do loop that executes the loop body until a condition is true.

We also looked at modularization control structures: the subroutine and function. Both the subroutine and function allow for programming logic to be encapsulated, both can accept zero to many parameters, and both are called using the same syntax. The difference between the two is that a function always returns a value, whereas a subroutine never does.

The next hour, "Working with Objects in Visual Basic," will be our last hour focusing specifically on Visual Basic's syntax and semantics. After that, we'll turn our attention back to the HTML portion of ASP.NET web pages.




Sams Teach Yourself ASP. NET 2.0 in 24 Hours, Complete Starter Kit
Sams Teach Yourself ASP.NET 2.0 in 24 Hours, Complete Starter Kit
ISBN: 0672327384
EAN: 2147483647
Year: 2004
Pages: 233

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net