VB里面能不能实例说下if语句的嵌套形式和多重分支语句,请贴出代码看看
1个回答
展开全部
For i = 1 To m
a(i) = Mid(Text1, i, 1)
If a(i) = "a" Then
a(i) = "A"
ElseIf a(i) = "e" Then
a(i) = "E"
ElseIf a(i) = "i" Then
a(i) = "I"
ElseIf a(i) = "o" Then
a(i) = "O"
ElseIf a(i) = "u" Then
a(i) = "U"
End If
Next
Text1 = ""
For i = 1 To m
Text1 = Text1 + a(i)
Next
其实嵌套形式和多重分支只要注意每一个IF 都要跟一个END IF 而且每一个IF后的下一个循环里面返回值都是返回到了开头而不是上一个IF循环
a(i) = Mid(Text1, i, 1)
If a(i) = "a" Then
a(i) = "A"
ElseIf a(i) = "e" Then
a(i) = "E"
ElseIf a(i) = "i" Then
a(i) = "I"
ElseIf a(i) = "o" Then
a(i) = "O"
ElseIf a(i) = "u" Then
a(i) = "U"
End If
Next
Text1 = ""
For i = 1 To m
Text1 = Text1 + a(i)
Next
其实嵌套形式和多重分支只要注意每一个IF 都要跟一个END IF 而且每一个IF后的下一个循环里面返回值都是返回到了开头而不是上一个IF循环
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询