VBScript:if..else语句

一个如果语句包括布尔表达式后跟一个或多个语句。如果说条件为True,则执行If条件下的语句。如果条件被认为是False,则将执行其他部分下的语句。

语法

T VBScript中if … else语句的语法是-

If(boolean_expression) Then
   Statement 1
	.....
	.....
   Statement n
Else
   Statement 1
	.....
	....
   Statement n
End If

流程图

VBScript:if..else语句

<!DOCTYPE html>
<html>
   <body>
      <script language = "vbscript" type = "text/vbscript">
         Dim a : a = 5
         Dim b : b = 25

         If a > b Then
            Document.write "a is Greater"
         Else 
            Document.write "b is Greater"
         End If
      </script>
   </body>
</html>

执行以上代码后,将产生以下结果:

b is Greater

作者:terry,如若转载,请注明出处:https://www.web176.com/vbscript/1288.html

(0)
打赏 支付宝 支付宝 微信 微信
terryterry
上一篇 2020年12月10日 下午3:12
下一篇 2020年12月10日 下午3:21

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注