< Back to IRCAM Forum

Conditional nil error

Hi all! I was working on a conditional problem and about half of the time I keep getting nil. I made sure that the nth-random was properly hooked up to a corresponding om=. I also tested to see if this was happening to a particular number, it seems to be random. There is no pattern to the nil.

So sorry if I’m missing something obvious.

Thanks
-Frank

Hi Frank,

For a start, and from what i see from your screenshot, i see an nth-random (on the top) which will be evaluated many times since it is connected with many om=. This means the output will be each time different. That might be your problem. To avoid this, you should consider to put your first (the one on top) nth-random in eval-once mode by:
select the method, type o.
Try this, Without the patch it is hard to say what is the problem here.

Now, ther3e might be another issue, where there’s no satisfactory condition is met, you should put an extra input in your conditional method outputing something without a ramdom, like say 60, or whatever.

The Conditional macro works as follows:
(cond
((first-test) result)
((seconf-test) result)

(t result)); here comes the last test which should be true, and outpus whatever

Best
K

Hi K,

Thank you very much for your solution! Applying the eval-once method worked perfectly.

Best,
Frank