Jump to content

global


tamir
 Share

Recommended Posts

i have a function that counts something and use "for" loop to assign number of vars (he number is the count result).

i don't know how many vars i will get so i used "for" loop that does something like this:

For $i=1 To $count
   Assign("var" & $i, $sometext)
Next

but since this code is in a function, the vars only declared in the function itself, and i can't use them in other functions, so i wanted to use Global for each var in the func.

how do i do that? or r there any other ways to global these vars?

Link to comment
Share on other sites

hmm i used the assign as u said, and in other func i did:

For $a=0 To $count
   $tmp = Eval("var" & $a)
   _ArrayDisplay($tmp)
Next

but it isn't working, why?

<{POST_SNAPBACK}>

Tamir,

In your first code you started with 1, so that would give: var1, var2, etc.

In this code you started with 0, but "var0" has not been assigned anything.

Regards,

-Sven

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...