POV-Ray : Newsgroups : povray.beta-test : Shorthand for conditionals Server Time: 30 Mar 2017 08:52:28 GMT
  Shorthand for conditionals (Message 1 to 3 of 3)  
From: Mike Horvath
Subject: Shorthand for conditionals
Date: 20 Nov 2016 01:58:33
Message: <58310349$1@news.povray.org>
Can I make a feature request?

It might be nice to have shorthand conditional statements that take the 
form of

#local r = r > 0.5 ? r - 0.055 : 12.92 * r;

Thanks.

Mike


Post a reply to this message

From: clipka
Subject: Re: Shorthand for conditionals
Date: 20 Nov 2016 02:33:29
Message: <58310b79$1@news.povray.org>
Am 20.11.2016 um 02:58 schrieb Mike Horvath:
> Can I make a feature request?
> 
> It might be nice to have shorthand conditional statements that take the
> form of
> 
> #local r = r > 0.5 ? r - 0.055 : 12.92 * r;

Such a conditional statement is already supported. For some strange
reason, such expressions have to be included in parentheses though:

#local r = (r > 0.5 ? r - 0.055 : 12.92 * r);


Post a reply to this message

From: Mike Horvath
Subject: Re: Shorthand for conditionals
Date: 20 Nov 2016 04:30:15
Message: <583126d7$1@news.povray.org>
On 11/19/2016 9:33 PM, clipka wrote:
> Am 20.11.2016 um 02:58 schrieb Mike Horvath:
>> Can I make a feature request?
>>
>> It might be nice to have shorthand conditional statements that take the
>> form of
>>
>> #local r = r > 0.5 ? r - 0.055 : 12.92 * r;
>
> Such a conditional statement is already supported. For some strange
> reason, such expressions have to be included in parentheses though:
>
> #local r = (r > 0.5 ? r - 0.055 : 12.92 * r);
>

Okay. Weird. I was getting errors and this explains why.

Mike


Post a reply to this message

Copyright 2003-2008 Persistence of Vision Raytracer Pty. Ltd.