假设totallvl
是一个整数并且chclass1
已经创建但chclass2
没有,为什么我可以这样做:
totallvl = chclass1.level
If chclass2 IsNot Nothing Then
totallvl = totallvl + chclass2.level
End If
但不是这个?
totallvl = chclass1.level + IIf(chclass2 Is Nothing, 0, chclass2.level)
就像编译器假设我将chclass2
在此示例中使用但不在第一个示例中使用一样。