POV-Ray : Newsgroups : povray.advanced-users : passing variable to macro for use in #for statement Server Time
28 Mar 2024 16:09:11 EDT (-0400)
  passing variable to macro for use in #for statement (Message 11 to 12 of 12)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Mike Horvath
Subject: Re: passing variable to macro for use in #for statement
Date: 21 Sep 2018 03:30:03
Message: <5ba49dfb$1@news.povray.org>
On 9/21/2018 12:51 AM, dick balaska wrote:
> On 09/20/2018 02:56 PM, Kenneth wrote:
> 
>>
>> This would be the (longer) way that I would write such a macro (just for
>> visual/mental clarity):
>>
>> #macro FormatKeyword(Format)
>> #if (Format = "png")
>> png
>> #else
>>       #if(Format = "jpeg")
>>       jpeg
>>       #else
>>            #if(Format = "bmp")
>>            bmp
>>            #else
>>            #end
>>       #end
>> #end
>> #end // of macro
>>
> 
> 
> I would write:
> 
> #macro FormatKeyword(Format)
>      #if (Format = "png") png #end
>      #if (Format = "jpeg") jpeg #end
>      #if (Format = "bmp") bmp #end
> #end
> 

You could use SWITCH and CASE as well.


Mike


Post a reply to this message

From: clipka
Subject: Re: passing variable to macro for use in #for statement
Date: 21 Sep 2018 07:25:36
Message: <5ba4d530$1@news.povray.org>
Am 21.09.2018 um 09:30 schrieb Mike Horvath:
> You could use SWITCH and CASE as well.

`#switch`/`#case` is cumbersome to use with strings.


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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