If statement testing for a 0 not working...

nicnut's icon

Hi,

I am trying to create an if statement and not sure what's wrong. I have 6 inputs, if all of them are equal to 0 then it should output a 0. if any of the inputs are any number other than 0, then I want it to output that number. Any suggestions on how this can work?

thanks in advance.

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

double_UG's icon

only the left input is hot

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

Source Audio's icon

few things are not working here :
1 - the 6 inputs must be run through pak 0 0 0 0 0 0
or bondo 6 objects so that ALL 6 values get output
whenever 1 of 6 changes. That's because if object will trigger output
only when first inlet receives something at input.
2 - zero & nonzero are symbols, number does not understand that.
3 - even if all above gets solved, if object can not output THAT value of THAT input.
not if You have 6 inputs and for example 3 are > 0, which one should be output ?
The first that came in ? the last ? or the highest ?
for that You need some other kind of logic.
Without knowing what exactly You want to do , it is difficult to offer a solution.
have a look at zl sum or maximum

nicnut's icon

Oh damn. yeah that makes a lot of sense. Thanks Doubleug for the reply.

How can I modify this so that the number that isn't a zero is passed through? So if a 6 is one of the numbers tested it comes through the output?

nicnut's icon

Thanks for the replies. I'm basically trying to whittle down this stream of numbers. If all of them are 0, and only in that case, I want a 0. Otherwise I want the number getting coming through. There will only be one number coming in at a time, but from 6 possible places.

Here is what I have, modified from Doubleug response above. I think this will work, but still curious if there is a way to get this with just the if object.

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

double_UG's icon

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

nicnut's icon

Doubleug, amazing. Thanks for your reply!

Nick