If...Then...Else Statement

Defines one or more statement blocks that you only want to execute if a given condition or expression is True.

语法:

If...EndIf statement


  If condition Then 
      statements
  [{ElseIf} condition Then
      statements]
  [Else 
      statements]
  {EndIf|End If}

Instead of End If you can write EndIf.

提示图标

If statements can be shortened to one line when using single statement blocks.



  If condition Then statement [Else statement]