Forums > MaxMSP

if, then statement

November 29, 2011 | 2:08 pm

Hello, I want to use the if-then object to route a number. However, I cannot get the number out of outlet 2. I cannot find the right statement in the help files. Can anyone help me out?

– Pasted Max Patch, click to expand. –

November 29, 2011 | 2:34 pm

if $i1 < = $i2 then $i1 out1 else out2 $i1


November 29, 2011 | 2:37 pm

You also need to specify what comes out of "out2" ($i1? $i2? a bang?)
Example:

if $i1 < = $i2 then $i1 else out2 $i1


November 29, 2011 | 3:10 pm

I wanted 4i1 coming out outlet 1 or 2. It is a bit weird that $i1 should be after out2 and not before like with out1. Anyway hz37: that is the correct statement it seems


November 29, 2011 | 5:09 pm

The "out1" is not a reserved word in this object, and is thus superfluous (and should be removed). It doesn’t show up in your patch because the number box and the button ignore it, but it’s being sent out.

You can think of the if statement’s format as:
if then [the left outlet] else [otherwise] out2 [create and use a second outlet to]
Note that out2 is optional, so you could elect to omit it and use the left outlet to .

– Pasted Max Patch, click to expand. –

Viewing 5 posts - 1 through 5 (of 5 total)