Results 1 to 12 of 12

Thread: How would this work? [Resolved]

Threaded View

  1. #1

    Thread Starter
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    How would this work? [Resolved]

    Howdy all,

    I'm wondering how Visual Basic (and probably, compilers in general) would handle a situation like this.

    Say I had this:
    VB Code:
    1. Dim theCounter As Long
    2.  
    3. Function DoSomething() As Long
    4. Randomize
    5. Dim theVariable As Long
    6. Do Until theCounter > 12
    7.     theVariable = Rnd() * 200
    8.     DoSomething
    9.     theCounter = theCounter + 1
    10. Loop
    11. End Function
    Its kind of hard to explain. If theVariable is set to a random number (in our case, say 100) on our first call, and then DoSomething is called again, another theVariable is declared, and set to a random number. Once this has all finished, would the variables be reset to their original values once the calling has been returned? I don't really know how to explain it. I'll try and draw up a diagram of what I mean. I just want to know before I try anything.

    Thanks in advance,

    Phreak
    Last edited by «°°phReAk°°»; May 4th, 2005 at 05:38 AM.

    Visual Studio 6, Visual Studio.NET 2005, MASM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width