假设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在此示例中使用但不在第一个示例中使用一样。