Csound Csound-dev Csound-tekno Search About

[Csnd] question concerning the syntax

Date2021-01-23 21:57
FromStefan Thomas
Subject[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.
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

Date2021-01-23 22:04
FromDave Seidel
SubjectRe: [Csnd] question concerning the syntax
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



On Sat, Jan 23, 2021 at 4:57 PM Stefan Thomas <kontrapunktstefan@gmail.com> wrote:
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.
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
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

Date2021-01-24 11:54
Fromjoachim heintz
SubjectRe: [Csnd] question concerning the syntax
in the flossmanual, it is explained here:
https://flossmanual.csound.com/csound-language/control-structures#short-form-a-v-b-x-y


On 23/01/2021 23:04, Dave Seidel wrote:
> 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
> 
> 
> 
> On Sat, Jan 23, 2021 at 4:57 PM Stefan Thomas 
> > wrote:
> 
>     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 
> 
> 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

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

Date2021-01-24 14:58
FromStefan Thomas
SubjectRe: [Csnd] question concerning the syntax
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.


Am So., 24. Jan. 2021 um 12:54 Uhr schrieb joachim heintz <jh@joachimheintz.de>:
in the flossmanual, it is explained here:
https://flossmanual.csound.com/csound-language/control-structures#short-form-a-v-b-x-y


On 23/01/2021 23:04, Dave Seidel wrote:
> 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
>
>
>
> On Sat, Jan 23, 2021 at 4:57 PM Stefan Thomas
> <kontrapunktstefan@gmail.com <mailto:kontrapunktstefan@gmail.com>> wrote:
>
>     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
>     <mailto: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
>
> Csound mailing list Csound@listserv.heanet.ie
> <mailto: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

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
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