Syntax for the if object

Jul 27, 2007 at 10:59am

Syntax for the if object

Hi,

I would like to reduce the number of objects used in my patch to the use of a single if object replacing the group of objects shown below.
The syntax would be something like :
if ($i1 == 1) and ($i2 >=0) and etc.. then 1 else 0
Except, that this does not work in the if object.
I have not programmed in C that much and can’t remember the syntax neither could I find some docs about this.
Thanks.

#P toggle 1020 334 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 1020 289 35 196617 bondo;
#P newex 1020 312 27 196617 &&;
#P newex 1073 248 35 196617 bondo;
#P newex 1073 271 27 196617 &&;
#P newex 1097 203 35 196617 bondo;
#P newex 1097 226 27 196617 &&;
#P newex 1058 204 35 196617 bondo;
#P newex 1058 227 27 196617 &&;
#P newex 1112 176 42 196617 < = 400;
#P newex 1079 176 30 196617 >= 0;
#P newex 1034 177 42 196617 < = 400;
#P newex 1001 177 30 196617 >= 0;
#P newex 966 177 31 196617 == 1;
#P connect 0 0 12 0;
#P connect 12 0 11 0;
#P connect 11 0 13 0;
#P connect 12 1 11 1;
#P connect 9 0 12 1;
#P connect 1 0 6 0;
#P connect 6 0 5 0;
#P connect 5 0 10 0;
#P connect 10 0 9 0;
#P connect 6 1 5 1;
#P connect 2 0 6 1;
#P connect 10 1 9 1;
#P connect 3 0 8 0;
#P connect 8 0 7 0;
#P connect 7 0 10 1;
#P connect 8 1 7 1;
#P connect 4 0 8 1;
#P window clipboard copycount 14;

#33058
Jul 27, 2007 at 11:23am

On 7/27/07, Al Go wrote:
>
>
> Hi,
>
> I would like to reduce the number of objects used in my patch to the use
> of a single if object replacing the group of objects shown below.
> The syntax would be something like :
> if ($i1 == 1) and ($i2 >=0) and etc.. then 1 else 0
> Except, that this does not work in the if object.

Hi.
It does work with if object, have a look at this example:

#P window setfont “Sans Serif” 9.;
#P number 91 70 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 138 70 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 185 70 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 232 70 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 44 70 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 44 93 201 9109513 bondo 5;
#P toggle 43 272 15 0;
#P newex 43 227 331 9109513 if ($i1==1) && ($i2>=0) && ($i3< =400) &&
($i4>=0) && ($i5< =400) then 1 else 0;
#P toggle 488 360 15 0;
#P newex 486 302 35 9109513 bondo;
#P newex 486 325 27 9109513 &&;
#P newex 476 241 35 9109513 bondo;
#P newex 476 264 27 9109513 &&;
#P newex 521 196 35 9109513 bondo;
#P newex 521 219 27 9109513 &&;
#P newex 437 197 35 9109513 bondo;
#P newex 437 220 27 9109513 &&;
#P newex 536 169 42 9109513 < = 400;
#P newex 503 169 30 9109513 >= 0;
#P newex 458 170 42 9109513 < = 400;
#P newex 425 170 30 9109513 >= 0;
#P newex 390 170 31 9109513 == 1;
#P connect 16 4 14 4;
#P connect 16 4 4 0;
#P connect 16 3 14 3;
#P connect 16 3 3 0;
#P connect 16 2 14 2;
#P connect 16 2 2 0;
#P connect 16 1 14 1;
#P connect 16 1 1 0;
#P connect 16 0 14 0;
#P connect 16 0 0 0;
#P connect 14 0 15 0;
#P connect 17 0 16 0;
#P connect 21 0 16 1;
#P connect 18 0 16 4;
#P connect 19 0 16 3;
#P connect 20 0 16 2;
#P connect 4 0 8 1;
#P connect 8 1 7 1;
#P connect 7 0 10 1;
#P connect 8 0 7 0;
#P connect 3 0 8 0;
#P connect 10 1 9 1;
#P connect 2 0 6 1;
#P connect 6 1 5 1;
#P connect 10 0 9 0;
#P connect 5 0 10 0;
#P connect 6 0 5 0;
#P connect 1 0 6 0;
#P connect 9 0 12 1;
#P connect 12 1 11 1;
#P connect 11 0 13 0;
#P connect 12 0 11 0;
#P connect 0 0 12 0;
#P window clipboard copycount 22;

Cheers.

#109570
Jul 28, 2007 at 11:43am

I knew I didn’t have the right syntax:

and vs &&

Thanks for your help!

#109571

You must be logged in to reply to this topic.