简单的asp问题( 为什么没有 end if 也能运行 )

来源:百度知道 编辑:UC知道 时间:2024/07/06 15:43:11
<%@language="VBSCript"%>
<%
response.buffer=true
c_value=request.cookies("c_value")
if c_value="" then c_value=Empty
response.write"进入网页时,c_value="&c_value&"<br>"
c_value=c_value+100
response.write "网页结束时,c_value="&c_value&"<br>"
response.cookies("c_value")=c_value
%>

-----------------------------------
为什么没有 end if 也能运行,不报错??

if(条件) then 执行语句不换行,是不需要end if的.
if(条件) then
执行语句换行
没有end if肯定报错.

不可能,没报错说明它不少,可能它写在其它地方结束了,仔细检查下

if then写在一行可以省略end if

if c_value="" then c_value=Empty
就相当于
if c_value="" then
c_value=Empty
end if