Conditional Operators

Overview

Conditional operators, together with variables and looping constructs, form the fundamental building blocks of programming languages and, therefore, applications. The Web-based applications you implement with ASP scripts can take advantage of both the flow control provided by conditional operators and the interactivity and sophistication of HTML.

Code Tour

This sample demonstrates the If ... Then, or if ... else statements in both VBScript and JScript, as well as the more complicated Select ... Case and switch ... case statements. Each statement demonstration performs the same task, sending a page to the client browser that consists of the current time and date and a greeting. The text of the greeting will be either "Good Morning" or "Good Evening," depending on whether the system clock reads A.M. or P.M.

Location

The VBScript and JScript versions of this script are available in the IIS samples directory, at ...\asp\simple\Conditional_VBScript.asp and ...\asp\simple\Conditional_JScript.asp.