I was sitting with a similar problem the last days, missing if-else, it looks like there is an example of how to get around it,using ? operator within codebox,, needing extra lines of code, intermittent variables
its about pd filters realized in gen
a bit down the page, porting c code to gen, >>stkr<< writes himself : (looks ridiculous - getting around GenExpr limitations)
Well, [gen~] is a synchronous language. Just because it has a C-like syntax...
Someone could prove me wrong, but I think it has to do with preserving state across time spent in the rendering loop. Currently with [gen~] everything is forgotten when the audio interrupt is exited. There are exceptions at the object level, like [sah].
But if conditionals have got your nose twisted, try anything that changes the flow of time, like a "for" or "while" loop!
greetings and just IF more people follow this if-else ? discussion THEN this tiny simple example is working, its doing C*sin(x) where C is variable parameter and x is fed back in the loop and trig is a running sample counter input, so that there will only be a new output every so many samples.
x = in1;
c = in2;
trig = in3;
xout = (trig == 1) ? c * (sin (x)) : x;
out1 = xout;
here on my babysocks in the code landscapes i hope that in this way there is some some cpu saving in the sense that the csinx calculation is only done IF trig==1.. for more complex algorithms this would matter i bet.