[Csnd] question concerning the syntax

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

https://flossmanual.csound.com/basics/random
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.

Stefan

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
else
kLowPchBound = -gkPitchDev
endif

in the flossmanual, it is explained here:
https://flossmanual.csound.com/csound-language/control-structures#short-form-a-v-b-x-y

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.