POV-Ray : Newsgroups : povray.advanced-users : user defined function : Re: user defined function Server Time
28 Jul 2024 18:14:21 EDT (-0400)
  Re: user defined function  
From: Tor Olav Kristensen
Date: 11 Jan 2006 20:09:38
Message: <43c5ac52@news.povray.org>
Warp wrote:
...
>   If the macro contains control flow commands, you have to use a small
> trick to put a "return value". It works for example like this:
> 
> #macro Func(A)
>   #if(A < 0)
>     #local Result = -A;
>   #else
>     #local Result = A;
>   #end
>   A
> #end
> 
>   The value of the last line of this macro is what is ultimately used as
> the "substitution" of the macro call, which is practice is its "return
> value".

Isn't this what you meant to write Warp ?

#macro Func(A)
   #if(A < 0)
     #local Result = -A;
   #else
     #local Result = A;
   #end
   Result
#end


-- 
Tor Olav
http://subcube.com


Post a reply to this message

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