Hello:
Thanks, Cor. I hadn't understood completely the discussion, because of my lack of experience in this groups (apart from the difficulty of speaking in English), I suppose.
I included that code because the first time I used "For Each" loops was with the FileSystemObject to rename files in a folder: the result was that sometimes the files that had changed the name appeared later in the same loop (but not always!), so I started using the method "first collect, then modify".
In respect to the "real" discussion of this thread I prefer explicit code rather than compact: I used compact code when programming my old Amstrad with a Z80, but after some years I prefer clear structures with a declared start and end ("Sub...End Sub" instead of "Proc(){...}"): that's why I don't like C: you end up with a lot of consecutive "}".
There is an example in other thread with one line like this (E is a structure):
E e3=(E) 3
and I prefer:
Dim e3 as E=E.3
I think its much clearer.
I apply the same for different methods of doing the same thing in VB: I always select the clearest one, not the fastest (if speed is not fundamental) nor the "prettiest", nor the most compact.
Well, that's my opinion, after so much posts...
;-) Regards.
"Cor" <
[email protected]> escribió en el mensaje | Hi,
| I'll try to "encapsulate" (please don't shoot) the short discussion.
|
| Nick did make a test program and the result was:
| That if you use a "for next loop", or a "do while loop", or with a "crappie
| method" or with a good other method, the process time is almost the same.
|
| Most of the writers are saying after that they had seen the measurement from
| Nick, "Do it your own way?
|
| The ones who prefer the reversal "for next" method do that because of the
| compactness of the code. The ones who prefer the "do while loop" did not
| tell why, maybe it just because they are used to do it that way.
|
| For me it is clear, I will use the "for next" loop in this situation because
| the compactness. And what others say, I gladly follow the words of Jay B.:
| "My concern is there is no 'uniform' answer! As there are multiple ways of
| doing the same thing, equally correct."
|
| Cor
|
|
|
|
|