VBScript CBoolFunction


VBScript 参考手册Complete VBScript Reference

The CBool function converts an expression to a Boolean type.

The expression must be a numeric value.

Syntax

CBool(expression)

Parameter Description
expression Required. Any valid expression. Non-zero values return True, zero returns False. If the expression cannot be interpreted as a numeric value, a run-time error occurs.

Example

Example

<script type="text/vbscript">

document.write(CBool(5) & "<br />")
document.write(CBool(0) & "<br />")
document.write(CBool(-5) & "<br />")

</script>

The output result of the above example is:

True
False
True

Try it Yourself »

VBScript 参考手册Complete VBScript Reference Other Extensions