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

 

VBScript CBool Function

Returns an expression that has been converted to a Variant of subtype Boolean.

Syntax: VBScript CBool Function

CBool(expression)

Arguments: VBScript CBool Function

expression

Any valid expression.

Remarks: VBScript CBool Function

If expression is zero, False is returned; otherwise, True is returned. If expression can't be interpreted as a numeric value, a run-time error occurs.

The following example uses the CBool function to convert an expression to a Boolean. If the expression evaluates to a nonzero value, CBool returns True; otherwise, it returns False.

Dim A, B, Check

A = 5: B = 5           ' Initialize variables.

Check = CBool(A = B)   ' Check contains True.

A = 0                  ' Define variable.

Check = CBool(A)       ' Check contains False.

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