In C,
"|" And "&" boolean operators are short-circuited, which is equivalent to the orelse and andalso operators of VB.
The "|" and "&" operators can be used not only for numerical operations, but also for Boolean operations. As a boolean operator, neither of them has the short circuit feature, which is equivalent to the OR and operator of VB.
Note: In fact, other C series languages (C/C ++ and Java) also have the same language features.
Using system; namespace consoleapplication1 {class program {static bool F () {console. writeline ("F ()"); Return true;} static void main (string [] ARGs) {console. writeline ("B1"); bool b1 = true | f (); B1 | = f (); console. writeline ("B2"); bool b2 = true | f (); b2 = b2 | f (); console. writeline ("B3"); bool B3 = false & F (); B3 & = f (); console. writeline ("B4"); bool B4 = false & F (); B4 = B4 & F () ;}}/* B1F () f () b2b3f () F () B4 */