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

2009-05-16 Thread Jonathan Wilkes



--- On Fri, 5/15/09, padovani  wrote:

> From: padovani 
> Subject: Re: [PD] [expr] for "if, then, else"?
> To: 
> Cc: pd-list@iem.at
> Date: Friday, May 15, 2009, 2:15 PM
> 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

Hi José
 I think the final 0 before the semicolon is the "else" part of the 
statement.  [expr if ($f3 > 0, $f1 + $f2, $f1 - $f2)] will give you only one 
outlet.  You can even nest if statements:
[expr if ($f3 > 0, $f1 + $f2, if ($f3 < 0, $f1 - $f2, 0))]

-Jonathan


  

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


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

2009-05-15 Thread Derek Holzer

Thanks all for sorting me out!

D.

--
::: derek holzer ::: http://blog.myspace.com/macumbista ::: 
http://www.vimeo.com/macumbista :::

---Oblique Strategy # 175:
"What are the sections sections of? Imagine a caterpillar moving"

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


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

2009-05-15 Thread Claude Heiland-Allen

Derek Holzer wrote:

So I try:

[expr $f1, $f2, $f3;


this is the problem, delete that section


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


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

2009-05-15 Thread padovani

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


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


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

2009-05-15 Thread Derek Holzer

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"

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list