Author Topic: Is it ok to reuse the same variable but change the value?  (Read 400 times)

Legacy_AmbrosiaPW

  • Jr. Member
  • **
  • Posts: 70
  • Karma: +0/-0
Is it ok to reuse the same variable but change the value?
« on: April 26, 2011, 07:35:07 am »


               I was wondering if there are any issues on this platform with reusing variables. Does anyone have anything good or bad to say about it?

Example:

void main()
{
string sMsg = "Hello!";
ActionSpeakString(sMsg,TALKVOLUME_TALK);

sMsg = "New Data"

ActionSpeakString(sMsg,TALKVOLUME_TALK);



}

Oh and how do I make code brackets on this forum? Thanks! 
               
               

               
            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
Is it ok to reuse the same variable but change the value?
« Reply #1 on: April 26, 2011, 08:25:51 am »


               Yes, you can reuse a variable within the same script.

As far as code brackets, how about placing the word "code" between two square brackets, the second with a slash "/" before the word "code"?

[code][/code]

               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Is it ok to reuse the same variable but change the value?
« Reply #2 on: April 26, 2011, 08:49:34 am »


               im using fore code brackets quoting actually. It formats the text better than code.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Is it ok to reuse the same variable but change the value?
« Reply #3 on: April 26, 2011, 05:19:47 pm »


               If you could not change the value of variables, they would not be variables, they would be constants.
               
               

               
            

Legacy_AmbrosiaPW

  • Jr. Member
  • **
  • Posts: 70
  • Karma: +0/-0
Is it ok to reuse the same variable but change the value?
« Reply #4 on: April 26, 2011, 06:45:53 pm »


               

Lightfoot8 wrote...

If you could not change the value of variables, they would not be variables, they would be constants.

haha yeah yeah ':whistle:'
I was just wondering if there may have been a funny parsing order. Ya know, like it doesn't destroy the item till the end. I just wanted to make sure I didnt waste my time.

I tried using [code=auto:0] and it didn't seem to do anything.