POV-Ray : Newsgroups : povray.newusers : if then statement... : Re: if then statement... Server Time
28 Jul 2024 22:19:06 EDT (-0400)
  Re: if then statement...  
From: Alain
Date: 10 Jul 2007 09:35:40
Message: <46938b2c$1@news.povray.org>
quoderatd nous apporta ses lumieres en ce 2007/07/10 08:17:
> #if (vecy1 > vecay | vecy1 = vecay)
> vaxis_rotate(veca, chiral, al* 2* pi/circum)
> else
> vaxis_rotate(veca, chiral, -a1* 2* pi/circum)
> 
> all the variables were previously declared.... but i get
> 
> Parse Error:Expected 'numeric expression', undeclared identifier 'vecy1'
> found instead
> 
> 
> And i don't know what you call it, but is there a way for me to group a
> bunch of #declare variables and if statements (so i guess identifiers)
> 
> I want to declare them 3 times each because of loops
> 
> 
> 
> 
> 
The error message means that the variable "vecy1" don't exist when referenced in 
the #if statement.
Make sure that every variable have been properly declared, with the same 
capitalisation, before the #if statement. make sure that the actual declaration 
cone was effectively parsed before the #if is encountered: any other #if before 
it? Are they properly terminated with the coresponding #end?
Any complex #declare? Are they properly closed with all required closing braces "}"?
It can be declared with #declare or #local. If using #local, is the deffinition 
still in scope?
A beter way to code your test is #if(vecy1 >= veca) shorter, faster to parse and 
easier to read.

By the way, it's strongly recomended to ALWAYS start user deffined variable by a 
CAPITAL leter to help prevent any eventual name clash. Keywords are all lower 
case, as are all built in variables. All lower case = reserved items, mixed case 
= user deffined.

-- 
Alain
-------------------------------------------------
  "Having a smoking area in a restaurant is like having a peeing area in a pool."
   --Thomas Pfeffer, American Heart Association


Post a reply to this message

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