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

作者:dnawo 来源:木子屋 时间:2008-01-25 19:00:00 

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

If condition Then
    [statements1]
Else
    [statements2]
End 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
%>

标签:if,true,VBScript
0
投稿

猜你喜欢

  • Yahoo! BrowserPlus 发布

    2008-11-20 13:35:00
  • 谷歌历年母亲节Logo一览

    2009-05-11 12:17:00
  • 如何取得刚添加的记录自动增加的ID?

    2010-01-18 20:55:00
  • javascript让浏览器实现复读机的功能

    2008-10-10 11:49:00
  • 浅析CMS生成静态页面的两种方案

    2008-03-17 12:51:00
  • 网站细节论(1)--阅读的细节

    2007-12-21 12:16:00
  • 可以实现在同一页面里的用多按钮进行提交吗?

    2009-11-01 18:04:00
  • 深入SQL SERVER 2000的内存管理机制

    2010-04-25 10:52:00
  • Google的YSlow——Page Speed(附插件下载)

    2009-09-27 12:40:00
  • 用 AjaxTags 简化 Ajax 开发

    2007-11-27 00:00:00
  • asp将table生成excel文件(xls)

    2011-03-07 11:17:00
  • 超半数中文网页一年内将“消失”

    2008-03-08 12:49:00
  • 绿色下划线的简洁CSS导航代码

    2007-09-17 12:51:00
  • asp如何用SA-FileUp上传多个HTML文件?

    2010-05-18 18:27:00
  • 聚焦 DreamWeaver MX 2004

    2010-03-25 12:22:00
  • dl.dt.dd.ul.li.ol区别及应用

    2008-05-24 09:42:00
  • 高效优化博客的用户阅读体验

    2009-06-16 18:09:00
  • mssql server 数据库附加不上解决办法分享

    2011-09-30 11:55:20
  • 奇淫技巧之图片切割

    2010-09-21 13:24:00
  • 深入浅出SQL之左连接、右连接和全连接

    2009-08-30 15:14:00
  • asp之家 网络编程 m.aspxhome.com