Boolean Logic - Check my work (plz)

Phil Maguire's icon

Hi all,

I'm putting together some simple two input logic gates with [if]. I think I've got the following working, could someone check and confirm? This is not at all my strong point :)

  • and

  • or

  • nand

  • nor

  • xor

  • xnor

Cheers!

Max Patch
Copy patch and select New From Clipboard in Max.

Jean-Francois Charles's icon

I'm not sure what you're trying to achieve. There are built-in logical objects AND and OR. [!- 1] will be your NOT. Then, you can make NAND and XOR by combining them.

Max Patch
Copy patch and select New From Clipboard in Max.

Roman Thilenius's icon


it is a nice exercise to build your own using if or expr, but of course it is not required.

here is for 8 inlets using expression. https://cycling74.com/forums/logic-gates

Roman Thilenius's icon


i´d also like to add that currently the second inlet does not trigger any output, which would lead to wrong results when used with 2 numberboxes.

and you should rethink the phrase if ($i1 ==$i2) && ($i2 ==$i1), which probably can be written in a shorter way. :)

Phil Maguire's icon

Jean-Francois - Mostly an exercise in understanding the logic better, and also getting to grips with the [if] syntax.

Roman - Ha, I see that now :)