3dani
September 19, 2001, 2:00pm
1
Hi All Guys, in my mel script i have a global variable, it is a string array initialize with some values.
this variable is declared and initialized at the beginning pof the script and then it's used by a procedure.
The second time i run the script i get the varning: "Global variable is already initialized; this occurrence is ignored".
What can i do in order to eliminate this warning?
thank you very much
Daniela
gmask
September 19, 2001, 6:11pm
2
Hey,
I guess you mainly want to prevent this warning for cleanliness because I don't think it will interrupt the functionality of your script.
I'm not sure what you mean by intialize.. do you mean using the clear command?
Here's a sample of what I would do and it doesn't produce such an error.
global string $test[]; clear $test; $test=ls; printls;
proc printls(){ global string $test[]; for($node in $test) { print $node; } }
g
3dani
September 20, 2001, 10:08am
3
In reply to: Hey,
I guess you mainly want to prevent this warning for cleanliness because I don't think it will interrupt the functionality of your script.
I'm not sure what you mean by intialize.. do you mean using the clear command?
Here's a sample of what I would do and it doesn't produce such an error.
global string $test[]; clear $test; $test=ls; printls;
proc printls(){ global string $test[]; for($node in $test) { print $node; } }g
Hi Adrian, well you'r right..it's not an error and my progam still goes on, but i don't want to get such warning...
initialized ... well i have something like this:
global string $text[]={ "Hi, Adrian", "how, are, you" };
then
global proc print() { global string $text[]; ... }
i've tried adding the clear command but it doesn't work...
bye daniela
gmask
September 20, 2001, 8:07pm
4
I think the problem is that you are declaring and assigning values to the variable at the same time. Declare that variable and then assign a value to it.
global string $text[]; $text=ls -sl;
Instead of: global string $text[]=ls -sl;
g