POV-Ray : Newsgroups : povray.general : declare a variable in a function : Re: declare a variable in a function Server Time
23 Jun 2021 00:31:06 EDT (-0400)
  Re: declare a variable in a function  
From: Tor Olav Kristensen
Date: 2 Apr 2021 13:40:00
Message: <web.606755c0db16780d6f19eb189db30a9@news.povray.org>
ingo <ing### [at] tagpovrayorg> wrote:
> i.i.r.c. there is/was a way to declare a variable in a function. But how?
> I don't remember and can't find it in the remnants of my archive.

You can not have variables that are local to the function. (And you can not have
any declarations of variables inside the function that are executed when you
call the function.) If a function is created within a macro, it can access
variables that are local to the macro. But be aware, because the scope of
function names are problematic and not well documented in POV-Ray.

Towards the end of this thread I explained how one can get around the problem
with missing local variables in functions:

Newsgroup: povray.text.scene-files
Date: 2003-11-19 16:55:01
Subject: My favourite isosurface (see p.b.i. for image)
Author: Alex Kluchikov
http://news.povray.org/povray.text.scene-files/thread/
%3Cweb.3fbbe555cd7b5c811235fd70%40news.povray.org%3E/

For those that have not yet tried to program in any functional languages, it may
be an interesting exercise to program this way.

--
Tor Olav
http://subcube.com
https://github.com/t-o-k


Post a reply to this message

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