[PD] [expr] for "if, then, else"?

Derek Holzer derek at umatic.nl
Fri May 15 13:49:21 CEST 2009


I would like to use [expr] for an "if, then, else" statement:

If $f3 > 0, then $f1 + $f2, else $f1 - $f2

In the help for [expr], I see the following:

[expr $f1;
if ($f1 > 0, $f1 * 2, 0);
if ($f1 <= 0, $f1 / 2, 0)]

So I try:

[expr $f1, $f2, $f3;
if ($f3 > 0, $f1 + $f2, 0);
if ($f3 < 0, $f1 - $f2, 0)]

but it doesn't create. I also tried without the final ",0" in each 
statement, and also this way:

[expr $f1, $f2, $f3;
if ($f3 > 0, $f1 + $f2, $f1 - $f2)]

Can someone explain to me the proper syntax for this?

D.

ps... gotta love the fact I can copy/paste text in and out of objects 
etc these days!


-- 
::: derek holzer ::: http://blog.myspace.com/macumbista ::: 
http://www.vimeo.com/macumbista :::
---Oblique Strategy # 142:
"Shut the door and listen from outside"




More information about the Pd-list mailing list