VB ASP 在一个 If Then 语句中声明多个变量

VB ASP declaring multiple variables in one If Then statement

我今天在 ASP 网站上使用一些旧的 VB。

我的代码如下:

arrRows = Split(sRows,",")
If arrRows(0) = "honesty" Then
honesty1= arrRows(1)
End If
If arrRows(0) = "honesty" Then
honesty2= arrRows(2)
End If
If arrRows(0) = "honesty" Then
honesty3= arrRows(3)
End If

我想将范围缩小到一个 If Then 语句,我可以在单个 If Then 语句中分配多个变量吗?如果是,怎么做?

谢谢!

是的,您可以在 If Then 语句中添加 1 个变量。

arrRows = Split(sRows,",")
If arrRows(0) = "honesty" Then
    honesty1= arrRows(1)
    honesty2= arrRows(2)
    honesty3= arrRows(3)
End If