----- Original Message -----
From: "reflexactions" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, December 20, 2007 3:35 PM
Subject: [flexcoders] Re: const?
> So your telling me that when you write a function if you have a var
> that wont change its value for the duration of that function say like:
> override protected function updateDisplayList(...):void{
> var count:int=numChildren;
> ..loop code..
> ...finished
> }
I only use constants when the value at declaration time is fixed. I wouldn't
consider your example to be a constant because numChildren can potentially
change, whether it does or not. It would be misleading to the developer to
try and describe a value as const when it was based upon a changing value -
definitely bad practice.
> you consider that bad code as count should be declared as a const
No, though the variable may be pointless if numChildren doesn't change and
it may be poorly named if numChildren does.
Paul
snip