POV-Ray : Newsgroups : povray.beta-test : Shorthand for conditionals Server Time
29 Mar 2024 09:29:07 EDT (-0400)
  Shorthand for conditionals (Message 1 to 3 of 3)  
From: Mike Horvath
Subject: Shorthand for conditionals
Date: 19 Nov 2016 20: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: 19 Nov 2016 21: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: 19 Nov 2016 23: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-2023 Persistence of Vision Raytracer Pty. Ltd.