POV-Ray : Newsgroups : povray.newusers : if then statement... Server Time
29 Jul 2024 00:25:46 EDT (-0400)
  if then statement... (Message 1 to 3 of 3)  
From: quoderatd
Subject: if then statement...
Date: 10 Jul 2007 08:20:02
Message: <web.469378bc285f3d241c9e60d70@news.povray.org>
#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


Post a reply to this message

From: Mike Williams
Subject: Re: if then statement...
Date: 10 Jul 2007 09:35:13
Message: <kf+a4GAWk4kGFwG2@econym.demon.co.uk>
Wasn't it quoderatd who wrote:
>#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

I suspect that there's some condition that's causing you to get to that
line without having declared vecy1.

Try to produce a simple example that exhibits the effect.

If there were something wrong with the POV-Ray parser, then I'd expect
to see the effect in a simple example like this:

#declare a=1;
#declare b=2;
#if (a > b | a = b)
  #debug "OK\n"
#end


Post a reply to this message

From: Alain
Subject: Re: if then statement...
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.