POV-Ray : Newsgroups : povray.advanced-users : Non-float #case values Server Time
29 Mar 2024 02:57:37 EDT (-0400)
  Non-float #case values (Message 1 to 4 of 4)  
From: Bald Eagle
Subject: Non-float #case values
Date: 5 Apr 2017 20:00:00
Message: <web.58e584232f620f0f80403a200@news.povray.org>
Would it take a lot to implement values in a #switch block, so that letters or
words could be used as selection criteria as well?

If not, or for the time being, is there a more elegant way to do this other than
a ton of #if ... #end's, or creating some sort of conversion index for the
strings?


Post a reply to this message

From: dick balaska
Subject: Re: Non-float #case values
Date: 5 Apr 2017 23:46:41
Message: <58e5ba21$1@news.povray.org>
Am 2017-04-05 19:56, also sprach Bald Eagle:
> Would it take a lot to implement values in a #switch block, so that letters or
> words could be used as selection criteria as well?
>
> If not, or for the time being, is there a more elegant way to do this other than
> a ton of #if ... #end's, or creating some sort of conversion index for the
> strings?
>
>

This is not so ugly, compared to a #switch:

#if     (word = "foo")
     ...
#elseif (word = "bar")
     ...
#elseif (word = "baz")
     ...
#end


-- 
dik


Post a reply to this message

From: Le Forgeron
Subject: Re: Non-float #case values
Date: 6 Apr 2017 12:16:44
Message: <58e669ec$1@news.povray.org>
Le 06/04/2017 à 01:56, Bald Eagle a écrit :
> Would it take a lot to implement values in a #switch block, so that letters or
> words could be used as selection criteria as well?
> 
> If not, or for the time being, is there a more elegant way to do this other than
> a ton of #if ... #end's, or creating some sort of conversion index for the
> strings?
> 
> 

for letter, you can convert it to its code in the switch clause :

#switch(asc(Char))
#case(65)
...


No clue for words, sorry.


Post a reply to this message

From: Bald Eagle
Subject: Re: Non-float #case values
Date: 6 Apr 2017 15:00:01
Message: <web.58e690108e3e055780403a200@news.povray.org>
Le_Forgeron <jgr### [at] freefr> wrote:

> for letter, you can convert it to its code in the switch clause :
>
> #switch(asc(Char))
> #case(65)
> ...

Yes, an excellent suggestion!   I will try to remember that.

> No clue for words, sorry.

Following your idea,
There's probably a way to generate a unique hash value.

Thanks as always   :)


Post a reply to this message

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