multiple declaration statements

  • Thread starter Thread starter Tim923
  • Start date Start date
T

Tim923

I developed a habit of using multiple declaration statements without
being aware of it, maybe from Pascal. Is that style no longer taught
or used?

decimal decTotalCost = 0M, decTotalDiscount = 0M,
decTotalExtendedPrice = 0M;

or

decimal decTotalCost = 0M;
decimal decTotalDiscount = 0M;
decimal decTotalExtendedPrice = 0M;

-
http://mysite.verizon.net/vze8adrh/news.html (profile) --Tim923 My email is valid.
 
Tim923 said:
I developed a habit of using multiple declaration statements without
being aware of it, maybe from Pascal. Is that style no longer taught
or used?

decimal decTotalCost = 0M, decTotalDiscount = 0M,
decTotalExtendedPrice = 0M;

or

decimal decTotalCost = 0M;
decimal decTotalDiscount = 0M;
decimal decTotalExtendedPrice = 0M;

The latter is clearer, IMO, and certainly allows for simpler
documentation. (I wouldn't use the Hungarian notation though.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top