|
-
Sep 10th, 2002, 07:54 PM
#1
Thread Starter
Member
good coding practice question
Hello,
Is it good practice to dim statements at the top of a sub/function even if they are only used under certain circumstances?
Example 1
Private sub abc_click(index as integer)
Dim intAbc as integer
select case index
case 1
for intAbc = 1 to lstcount
debug.print "hello"
next intAbc
Case 2
debug.print "hello"
End select
or this:
Private sub abc_click(index as integer)
select case index
case 1
Dim intAbc as integer
for intAbc = 1 to lstcount
debug.print "hello"
next intAbc
Case 2
debug.print "hello"
End select
The second example would be the most memory efficient way, but is that the way to do it?
Thanks
Rick
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|