Closed Thread Icon

Topic awaiting preservation: Merging variable names :DD (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12200" title="Pages that link to Topic awaiting preservation: Merging variable names :DD (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Merging variable names :DD <span class="small">(Page 1 of 1)</span>\

 
Smash
Bipolar (III) Inmate

From: Stockholm, Sweden
Insane since: Sep 2001

posted posted 05-02-2002 10:40

Hi everybody!

I have a simple question (I hope)...

I want to know how to create dynamic variable names in VBScript to be able to make an iteration... Something like eval in JavaScript...

Example:
*********

For bla = 1 to 10

a[bla] = 1

Next
*********
(Now I want a[bla] to become the variables a1, a2, a3 and so on and everyone should have value 1... (later on it may be some other value than 1 of course )


Hope you understand the question...

Thanks in advance

Smash



InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 05-02-2002 11:05

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

stinx
Bipolar (III) Inmate

From: London, UK
Insane since: Apr 2002

posted posted 05-09-2002 16:22

Sounds like you should be using an array in your script...

a1, a2, a3 looks a lot like a(1), a(2), a(3) to me.

The only time I can see you needing seperate variables is if you were to pass these values over to a script through a POST form or GET string.

Of course, there is the equivalent of the eval statement in VBScript anyway...

for i = 1 to 10
execute("a" & i & " = 1")
next

Not sure how this works with Dim if you have OptionExplicit set, but it should get you started.

stinx

(just trying to answer this reminds me how much I love php!)


« BackwardsOnwards »

Show Forum Drop Down Menu