[二级VB试题天天练]VB考试试题8

全国等级考试资料网 2022-10-30 03:02:23 115

11.程序控制结构练习(1) 
下列程序段的运行结果是?
Dim i As Integer
Dim X As Integer
i = 2
X = 4
Select Case i
    Case 0
        Print "Case 0"
    Case 1
        Print "Case 1"
    Case X - i
        Print "Case X - i"
    Case X
        Print "Case X"
    Case Else
        Print "Case Else"
End Select

运行程序后可以看到结果是
Case X - i

因为表达式“X - i”的返回值和要检查的表达式“i”的返回值是相同的,
所以会执行Case X - i 语句。

相关资料

相关阅读