|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
I do not usually use the colon in my code however sometimes i find it usefull
e.g. pulling data from an array .... i += 1 : this = stuff(i) i += 1 : that = stuff(i) i += 1 : theOther = stuff(i) .... as it reads more clearly than incrementing i on a separate line. Is this considered bad practice? guy
Show quote
Hide quote
"guy" <g**@discussions.microsoft.com> schrieb I did it many years ago, then considered it bad practice for many years, now > I do not usually use the colon in my code however sometimes i find > it usefull e.g. > > pulling data from an array > > ... > i += 1 : this = stuff(i) > i += 1 : that = stuff(i) > i += 1 : theOther = stuff(i) > ... > > as it reads more clearly than incrementing i on a separate line. > Is this considered bad practice? I start considering it a legitimate way (in some cases like your example) So: A matter of taste. Armin guy wrote:
> I do not usually use the colon in my code .... likewise ...> however sometimes i find it useful, e.g. pulling data from an array Personally, unless both of these arrays are dynamic and the index ranges > ... > i += 1 : this = stuff(i) > i += 1 : that = stuff(i) > i += 1 : theOther = stuff(i) > ... all over the place, I'd just /hard-code/ the offsets: Const XOffset as Integer = 0 Const YOffset as Integer = 1 Const ZOffset as Integer = 2 this = stuff( i + XOffset ) that = stuff( i + YOffset ) theOther = stuff( i + ZOffset ) > as it reads more clearly than incrementing i on a separate line. Agreed.> Is this considered bad practice? It certainly /used/ to be (I'm thinking VB6 here) because it was darned difficult to put breakpoints on the second and subsequent statements on a given line. I don't think it's a problem any more, so whatever works for you... HTH, Phill W. Show quoteHide quote > > guy
Running vb.net 2005 app under windows restricted user
Type inference how do you implement association between objects Check if libraries or program exist dataset question error with exe programs fast updates to textbox? Emailing a form in Visual Basic 2005 Express Need to develop an IDE add-on that would behave similar to the Find in Entire Solution data to datagrid |
|||||||||||||||||||||||