POV-Ray : Newsgroups : povray.advanced-users : Bitwise AND : Re: Bitwise AND Server Time
28 Jul 2024 20:21:29 EDT (-0400)
  Re: Bitwise AND  
From: Christopher James Huff
Date: 4 Apr 2004 20:12:28
Message: <cjameshuff-DD658D.20130704042004@news.povray.org>
In article <407004ff@news.povray.org>,
 Andrew C on Mozilla <voi### [at] devnull> wrote:

> I was then shocked to find that
>    #if (Flag = "Z")
> gives me an error... it was later pointed out that
>    #if (asc(Flag) = asc("Z"))
> works just fine. Weird... Anyway, I went this way because "nCV" is more 
> instantly understandable than 0x03. ;-) Just a thought...

The equality operator expects numeric values, which strings aren't. Not 
so weird, though scripting languages usually have better built-in 
support for strings, POV Script isn't intended to do much string 
processing. Anyway, that's an odd way of comparing strings, and only 
works for single characters. This is the usual method:

#if(strcmp(Flag, "Z") = 0)

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

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