Csound Csound-dev Csound-tekno Search About

short form

Date2017-03-19 13:04
FromMenno Knevel
Subjectshort form
i wondered if and how i could rewrite

if ibasehz == -1 then 
    ibasehz =   261.625565
else
    ibasehz =   100
endif

to 

ibasehz =   (ibasehz = -1 ? ibasehz = 261.625565: ibasehz =   100)

but i keep getting errors.
Can this be done in short form?



--
View this message in context: http://csound.1045644.n5.nabble.com/short-form-tp5755153.html
Sent from the Csound - General mailing list archive at Nabble.com.

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

Date2017-03-19 13:07
FromJustin Smith
SubjectRe: short form
I don't think assignment returns anything useful, but the ternary operator does

ibasehz = (ibasehz == -1) ? 261.625565 : 100

the ternary expression will return 261.625565 or 100, and that will replace the value of ibasehz

On Sun, Mar 19, 2017 at 6:04 AM Menno Knevel <magknevel@gmail.com> wrote:
i wondered if and how i could rewrite

if ibasehz == -1 then
    ibasehz =   261.625565
else
    ibasehz =   100
endif

to

ibasehz =   (ibasehz = -1 ? ibasehz = 261.625565: ibasehz =   100)

but i keep getting errors.
Can this be done in short form?



--
View this message in context: http://csound.1045644.n5.nabble.com/short-form-tp5755153.html
Sent from the Csound - General mailing list archive at Nabble.com.

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

Date2017-03-19 13:14
FromMenno Knevel
SubjectRe: short form
Thanks Justin, this works nicely
and gives me something to study.

much appreciated!



--
View this message in context: http://csound.1045644.n5.nabble.com/short-form-tp5755153p5755156.html
Sent from the Csound - General mailing list archive at Nabble.com.

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