Re: [Flashcoders] const inside function
Ok, thanks. Yes that makes sense. I was thinking that it might be a
slight enhancement to speed up execution time of a function.
Jiri
On 05-08-10 19:20, Juan Pablo Califano wrote:
The difference is that the reference is constant, meaning you cannot change
it.
You can't do this:
const my_var:String = "my_var";
my_var = "other text";
You could do this if it were declared as a var.
Cheers
Juan Pablo Califano
2010/8/5 Jiri
I have a simple question. I came across some code in a project that defines
a const in a function.
function doSomething():void{
const my_var:String = "my_var"
var buffer:String = '';
for(var i:int = 0 ; ihttp://chattyfig.figleaf.com/mailman/listinfo/flashcoders
___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] const inside function
The difference is that the reference is constant, meaning you cannot change
it.
You can't do this:
const my_var:String = "my_var";
my_var = "other text";
You could do this if it were declared as a var.
Cheers
Juan Pablo Califano
2010/8/5 Jiri
> I have a simple question. I came across some code in a project that defines
> a const in a function.
>
> function doSomething():void{
>const my_var:String = "my_var"
>
>var buffer:String = '';
>
>for(var i:int = 0 ; ibuffer += list[i] + my_var
>}
> }
>
> What is the difference compared to this:
>
> function doSomething():void{
>var my_var:String = "my_var"
>var buffer:String = '';
>
>for(var i:int = 0 ; ibuffer += list[i] + my_var
>}
> }
>
> Regards,
>
> Jiri
> ___
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

