On Fri, May 5, 2017 at 10:26 AM, roger peppe <rogpe...@gmail.com> wrote: > On 5 May 2017 at 14:11, Michael Jones <michael.jo...@gmail.com> wrote: >> Just so. One cannot do boolean arithmetic with boolean variables. >> >> We have: >> EQUIVALENCE ("==") >> XOR ("!=") >> NOT ("!") -- George Boole's NEGATION >> >> We lack: >> AND ("&") -- George Boole's CONJUNCTION >> OR ("|") -- George Boole's DISJUNCTION >> >> As it happens, one can implement all the operators from the basis of >> NEGATION and either CONJUNCTION or DISJUNCTION, but as we lack each of the >> last two, one must be sure to use ints where bools would be natural. > > I don't get it. What's the difference between a&&b > and the hypothetical a&b for two expressions a and b, > assuming a and b are free of side-effects ?
There is none. But sometimes b has a side-effect. And sometimes you want that side-effect to be executed whether or not a is true. Then writing `a && b` does not work, and the alternatives are either verbose or require introducing a new temporary variable name. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.