POV-Ray : Newsgroups : povray.newusers : Problem with #switch : Re: Problem with #switch Server Time
28 Jul 2024 18:14:07 EDT (-0400)
  Re: Problem with #switch  
From: Chris B
Date: 12 Feb 2008 03:28:46
Message: <47b158be@news.povray.org>
"Archpawn" <nomail@nomail> wrote in message 
news:web.47b0ded4bd25e05c9c37dbc40@news.povray.org...
> When I try to compile the following code, it says there should be a ) 
> after X+1.
> Am I doing this right? It's supposed to return X+1 if Dir = 0 or 1, X if 
> it's 2
> or 5, and X-1 if it's 3 or 4.
> #macro NextX(X,Dir)
>   #switch(Dir)
>      #case(0)
>      #case(1)
>         X+1
>      #break
> ... snip ...

I cut and pasted your macro into a new empty file and added the one line
#debug concat("AAAAA: ",str(NextX(1,0),3,0),"\n")

I ran it with a couple of different parameters and it worked as expected 
(Black image, but a number returned to the message stream).

Are you sure you don't have an error in the main body of your code?
If you've got an open bracket out of place before any of the macro 
invocations, then that would explain the message.

Regards,
Chris B.


Post a reply to this message

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