Internet Explorer 6 is not supported.
Upgrade to view this site.

Defining Variables in Comma Form

Posted on April 30, 2009 at 11:52 pm

Sometimes when I check out other people’s code I see things that I never do when I program. Sometimes they are kind of cool and if I like it enough, it becomes part of my workflow. While looking at some code the other day I saw something that I have never seen before. Variables defined in a comma delimited list. Below is how I normally go about defining variables.

1
2
3
4
5
6
7
8
var red:uint;
var grn:uint;
var blu:uint;
var i:Number;
var f:Number;
var p:Number;
var q:Number;
var t:Number;

The above can also be defined shorthanded using a few less lines. It’s a little thing, but you end up not rewriting the variable declaration every time this way.

1
2
var red:uint, grn:uint, blu:uint;
var i:Number, f:Number, p:Number, q:Number, t:Number;

Leave a Comment

*Required fields. Email will not be published.