当前位置: 首页 > 图文教程 > 网络编程 > ASP > ASP:True or False,明明白白你的If语句流程

ASP
Microsoft 脚本编码器(3) --- 使用脚本编码器
WAP中的ASP技术(一)
WAP中的ASP技术(二)
WAP中的ASP技术(三)
WAP中的ASP技术(四)
在ADO使用SELECT语法一
在ADO使用SELECT语法二
在ADO使用SELECT语法三
在ADO使用SELECT语法四
在ADO使用SELECT语法五
在ADO使用SELECT语法六
Asp+语法介绍(六)----数据库篇
vbscript错误代码及对应解释大全
ASP系列讲座(三)创建 ASP 页
ASP系列讲座(四)使用脚本语言
ASP系列讲座(五)使用变量和常量
ASP系列讲座(六)编写过程
ASP系列讲座(七)使用组件和对象
ASP系列讲座(八)使用集合
ASP系列讲座(九)设置对象作用域

ASP:True or False,明明白白你的If语句流程


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 137 ::
收藏到网摘: n/a

通过学习ASP明明白白你的If语句流程。

上边是VBScript脚本If语句的语法,当condition值为True时执行statements1,当condition值为False时执行statements2,由于VBScript的类型自动转换功能,当condition的值为非0的数值时和True等效,当condition的值为0时和False等效。

实际运用中,我们必须对condition的值有充分的认识,才能对If语句的流程胸有成足。下边我们再举一些例子来加深记忆:

以下为引用的内容:

<%
Dim condition
condition = Response.IsClientConnected
If condition Then
    Response.write("True")
Else
    Response.write("False")
End If
'condition = True  ,  Result:True
'condition = False ,  Result:False
'condition = 2     ,  Result:True
'condition = 0.01  ,  Result:True
'condition = 0     ,  Result:False
'condition = 0.00  ,  Result:False
'condition = isNumeric(3)    , Result:True
'condition = isNumeric("aa") , Result:False
'condition = Array(0,1,"aa","bb")(0) , Result:False
'condition = Array(0,1,"aa","bb")(1) , Result:True
'condition = Response.IsClientConnected , Result:True
%>