[Csnd] question concerning the syntax

Dear community,
I try to understand Joachim’s example of a random walk, which I found at

When I studied the code, I found a line, which I don’t understand.
I’ve no idea what

kLowPchBound = gkPitchDir < 0 ? -gkPitchDev+gkPitchDir : -gkPitchDev

could mean.
Could someone give me a hint?
Thanks for Your help.


Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

This is an example of what’s called a ternary expression, a shorthand way to express a conditional statement.

Here’s another way to say the same thing, more verbosely:

if gkPitchDir < 0 then
kLowPchBound = -gkPitchDev+gkPitchDir
kLowPchBound = -gkPitchDev

in the flossmanual, it is explained here:

Dear Dave, der Joachim,
thanks for Your replies. I do understand now.

I’m still trying to understand, how random walk works, or how it can be implemented, but that’s another thing.