COMMUNITY

Local variable x used without being initialized

Hej !

Some times ago I remember we had to initialize a local variable.
Is it no more need for that now ? Since when please ? I didn’t noticed that…

You still can’t use an uninitialized variable, doing

function main() {
  var a;
  trace(a);
}

will give

Local variable a used without being initialized

Not to confound with a null variable, an uninitialized variable is a variable without a value, not a variable without a valid value, since null is a value having var a = null; count as initializing the variable a (with the value null).

Ah ok ! Now I understand !
So you can do :

var a;
...
a = something;
...

Thanks Valentin ! :wink: