bea*_*ach 109
使用IF().
它是一个短路三元运算符.
Dim Result = IF(expression,<true return>,<false return>)
Run Code Online (Sandbox Code Playgroud)
也可以看看:
Qui*_*son 24
它实际上非常简单..
If CONDITION Then ..INSERT CODE HERE..
Run Code Online (Sandbox Code Playgroud)
xpd*_*pda 14
冒着被purests和c#程序员引起一些烦恼的风险,你可以使用多个语句,或者在VB中使用单行if语句.在这个例子中,y结束3而不是7.
i = 1
If i = 1 Then x = 3 : y = 3 Else x = 7 : y = 7
Run Code Online (Sandbox Code Playgroud)
Flu*_*ert 13
不知道为什么人们还没发布这个......
单线
句法:
If (condition) Then (do this)
Run Code Online (Sandbox Code Playgroud)
例:
If flag = true Then i = 1
Run Code Online (Sandbox Code Playgroud)
多个ElseIf
句法:
If (condition) Then : (do this)
ElseIf (condition2) Then : (do this)
Else : (do this)
End If
Run Code Online (Sandbox Code Playgroud)
要么
If (condition) Then : (do this) : ElseIf (condition2) Then : (do this) : Else : (do this) : End If
Run Code Online (Sandbox Code Playgroud)
多个操作
句法:
If (condition) Then : (do this) : (and this) : End If
Run Code Online (Sandbox Code Playgroud)
希望这会对某人有所帮助.
| 归档时间: |
|
| 查看次数: |
99819 次 |
| 最近记录: |