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

padovani josepadovani at yahoo.com.br
Fri May 15 14:15:30 CEST 2009


You don't need to declare the variables...

it is just:

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

but you will have 2 outlets (one for each "if"), and not an "else" for 
the same outlet.... in fact, it would be nice to have an "else" on 
Yadegari's externals...
For more information see: http://www.crca.ucsd.edu/~yadegari/expr.html

josé

Derek Holzer escreveu:
> 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!
>
>

-- 
http://www.padovani.googlepages.com





More information about the Pd-list mailing list