Why is short-circuiting not the default behavior in VB?

前端 未结 3 722
旧时难觅i
旧时难觅i 2021-01-17 10:25

VB has operators AndAlso and OrElse, that perform short-circuiting logical conjunction.

Why is this not the default behavior of And

3条回答
  •  攒了一身酷
    2021-01-17 10:29

    Explicit short-circuit makes sure that the left operand is evaluated first.

    In some languages other than VB, logical operators may perform an implicit short circuit but may evaluate the right operator first (depending for instance on the complexity of the expressions at left and at right of the logical operator).

提交回复
热议问题