Sun Chili!Soft ASP Sun Chili!Soft
ASP Sun Microsystems

 

JScript @if Statement

Conditionally executes a group of statements, depending on the value of an expression.

Syntax: JScript @if Statement

@if (condition1)

text1

[@elif (condition2)

text2]

[@else

text3]

@end

Arguments: JScript @if Statement

condition1, condition2

An expression that can be coerced into a Boolean expression.

text1

The text to be parsed if condition1 is True.

text2

The text to be parsed if condition1 is False and condition2 is True.

text3

The text to be parsed if both condition1 and condition2 are False.

Remarks: JScript @if Statement

When writing an @if statement, its clauses do not have to appear on separate lines. In addition, you may use multiple @elif clauses. If you do, all must come before an @else clause.

You commonly use the @if statement to determine which text among several options should be used for text output. For example:

alert(@if (@_win32) "using Windows NT or Windows 95"

@else "using Windows 3.1" @end)

Copyright 2002 Sun Microsystems, Inc. All rights reserved. Legal Notice.