Jump to content

Wildcard in loop


Recommended Posts

I want to cycle through variables where the first half are all the same, and the last portion is different, so the last half has to be a wildcard.

Ex.

The variables look like

$FFF_1_cat

$FFF_2_dog

$FFF_3_mouse

$FFF_4_rat

Then theoretically, my loop would look something like this

for $i = 1 to 4

$doing_something = $FFF_" & $i & $i "_*";<=============SEE THE WILDCARD?

next

Possible?

Link to comment
Share on other sites

I don't think so. Variables are unique. Using a wildcard will require to check every variable that matches the pattern one by one. You can't check all at once.

You can use Eval() to loop this way:

Not tested:

$FFF_1
$FFF_2
$FFF_3
$FFF_4

for $i = 1 to 4
   $doing_something = Eval("FFF_" & $i )
next

:)

Link to comment
Share on other sites

I am actually doing an Eval loop, I just wanted to be able to keep some type of suffix on my names so I can quickly know what I am looking at in a glance, instead of numbers(I have numbers already included of course, for the Eval Loop). Well, I guess it's a no go with that.

Thanks.

Edited by Champak
Link to comment
Share on other sites

I am actually doing an Eval loop, I just wanted to be able to keep some type of suffix on my names so I can quickly know what I am looking at in a glance, instead of numbers(I have numbers already included of course, for the Eval Loop). Well, I guess it's a no go with that.

Thanks.

Then don't you think that the use of Wildcards and loops is a bit contradictory? If you understand how to use C/C++ style structures, then use DllStructCreate() and I think it'll get you a step closer.

Arrays are a good option too, in my opionion.

Good luck.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...