ฟังก์ชั่น VBScript CBool
ฟังก์ชั่น CBool การแปลงนิพจน์เพื่อบูลีน (บูลีน) ประเภท
การแสดงออกจะต้องเป็นค่าตัวเลข
ไวยากรณ์
CBool(expression)
参数 | 描述 |
---|---|
expression | 必需。任何有效的表达式。非零的值返回 True,零返回 False。如果表达式不能解释为数值,则发生 run-time 错误。 |
ตัวอย่าง
ตัวอย่าง
<script type="text/vbscript">
document.write(CBool(5) & "<br />")
document.write(CBool(0) & "<br />")
document.write(CBool(-5) & "<br />")
</script>
document.write(CBool(5) & "<br />")
document.write(CBool(0) & "<br />")
document.write(CBool(-5) & "<br />")
</script>
ตัวอย่างของการส่งออกดังกล่าวข้างต้น:
True
False
True
False
True
ลอง»
อ้างอิง VBScript สมบูรณ์