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

 

JScript @set Statement

Allows creation of variables used in conditional compilation statements.

Syntax: JScript @set Statement

@set @varname = term

Arguments: JScript @set Statement

varname

A valid JScript variable name. Must be preceded by an "@" character at all times.

term

Zero or more unary operators followed by either a constant, conditional compilation variable, or parenthesized expression.

Remarks: JScript @set Statement

Numeric and Boolean variables are supported for conditional compilation. Strings are not. Variables created using @set are generally used in conditional compilation statements, but can be used anywhere in JScript code.

Examples of variable declarations look like this:

@set @myvar1 = 12

@set @myvar2 = (@myvar1 * 20)

@set @myvar3 = @_jscript_version

The following operators are supported in parenthesized expressions:

! ~

* / %

+ -

<< >> >>>

< <= > >=

== != === !==

& ^ |

&& ||

If a variable is used before it has been defined, its value is NaN. NaN can be checked for using the @if statement:

@if (@newVar != @newVar)

...

This works because NaN is the only value not equal to itself.

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