# What is the reason this is done?

**URL:** <https://forum.kirupa.com/t/what-is-the-reason-this-is-done/284083>\
**Category:** flash\
**Created:** [March 14, 2009, 9:15pm UTC](https://forum.kirupa.com/t/what-is-the-reason-this-is-done/284083 "2009-03-14T21:15:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tsukiyomi](https://avatars.discourse-cdn.com/v4/letter/t/e5b9ba/32.png) [@Tsukiyomi](https://forum.kirupa.com/u/Tsukiyomi)\
**Post date:** [March 14, 2009, 9:15pm UTC](https://forum.kirupa.com/t/what-is-the-reason-this-is-done/284083/1 "2009-03-14T21:15:03Z")

</div>

I’ve seen something in a few custom classes, tutorials and articles I’ve read as to how people handle their class variables.

Sometimes I see it set up like this:

private var container:Sprite;  
private var box:TextField;

And then inside of the constructor and other functions is where they have this:

container = new Sprite();  
box = new TextField();

My question is is this just a matter of programming style or is there a reason for doing it this way as opposed to:

private var container:Sprite = new Sprite();  
private var box:TextField = new TextField();

Which requires two less lines of code.
