-- The confirmation test of [Short-circuit type] -- ================================================================ [VBA, OOoBasic] Not Short-circuit Sub Main MsgBox "And Result:" & CBool(True_Value(1) and True_Value(2)) MsgBox "And Result:" & CBool(True_Value(1) and False_Value(2)) MsgBox "And Result:" & CBool(False_Value(1) and True_Value(2)) MsgBox "And Result:" & CBool(False_Value(1) and False_Value(2)) '-------------------------- MsgBox "Or Result:" & CBool(True_Value(1) or True_Value(2)) MsgBox "Or Result:" & CBool(True_Value(1) or False_Value(2)) MsgBox "Or Result:" & CBool(False_Value(1) or True_Value(2)) MsgBox "Or Result:" & CBool(False_Value(1) or False_Value(2)) End Sub Function True_Value(ByVal ID As Integer) As Boolean MsgBox "True_Value:" & ID True_Value = true End Function Function False_Value(ByVal ID As Integer) As Boolean MsgBox "False_Value:" & ID False_Value = false End Function ================================================================ [JavaScript] Short-circuit
================================================================ [Delphi] Short-circuit begin showmessage('And Result:' + BoolToStr(True_Value(1) and True_Value(2))); showmessage('And Result:' + BoolToStr(True_Value(1) and False_Value(2))); showmessage('And Result:' + BoolToStr(False_Value(1) and True_Value(2))); showmessage('And Result:' + BoolToStr(False_Value(1) and False_Value(2))); showmessage('Or Result:' + BoolToStr(True_Value(1) or True_Value(2))); showmessage('Or Result:' + BoolToStr(True_Value(1) or False_Value(2))); showmessage('Or Result:' + BoolToStr(False_Value(1) or True_Value(2))); showmessage('Or Result:' + BoolToStr(False_Value(1) or False_Value(2))); end; function True_Value(ID : Integer) : Boolean; begin showmessage('True_Value:' + IntToStr(ID)); Result := true; end; function False_Value(ID : Integer) : Boolean; begin showmessage('False_Value:' + IntToStr(ID)); Result := false; end; ================================================================