O'Reilly logo

Special Edition Using® Microsoft® ASP.NET by Richard Leinecker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Program Control

To direct the flow of program execution, the .NET languages support several control-flow statements. These act as you would expect. The following sections examine each, beginning with the popular if statement.

If Statements

There are two types of if statements, both of which require the use of a Boolean expression. These are the syntaxes for the most basic if statement:

VB

If boolean expression Then 
    ' Do some stuff here 
End If 

C#

if( boolean expression) 
{ 
    // Do some stuff here 
} 

JScript

if( boolean expression) 
{ 
    // Do some stuff here 
} 

Depending on the value of the Boolean expression, the body of the if statement may or may not be executed. If the expression evaluates to true, the body is executed. If the expression evaluates ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required