Aller au contenu

Photo

Is it ok to reuse the same variable but change the value?


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
AmbrosiaPW

AmbrosiaPW
  • Members
  • 35 messages
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! 

#2
The Amethyst Dragon

The Amethyst Dragon
  • Members
  • 1 882 messages
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]


#3
Shadooow

Shadooow
  • Members
  • 4 471 messages
im using fore code brackets quoting actually. It formats the text better than code.

#4
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
If you could not change the value of variables, they would not be variables, they would be constants.

#5
AmbrosiaPW

AmbrosiaPW
  • Members
  • 35 messages

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.