ques re help file examples - don't set objs to nothing?

ques re help file examples - don't set objs to nothing?

Anonymous
Not applicable
292 Views
4 Replies
Message 1 of 5

ques re help file examples - don't set objs to nothing?

Anonymous
Not applicable
On the subject of setting object variables to nothing when they're no longer
needed, I have looked at many help file code examples on diff subjects and
not found any that follow that rule. Is that intentional to teach us
beginners bad programming manners?

--
related ques: is this a different case?
Function MirrorObjSet(objSet, mirrptarr)

Dim obj1 As AcadEntity

For Each obj1 In objSet
...do something with obj1...
next obj1
end sub

Here, obj1 was never set using the 'Set' command?/keyword?/function?
so does it still need set to nothing at the end or is this different?

[email protected]
A.T. Renczarski and Co., inc.
p 816.587.0101
f 816.587.5691
0 Likes
293 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Hi Mark. Tis example is indeed a bit different. When using For Next to iterate a set of objects,
the iterator is automatically pointed at the next object in the collection.

--

Mark Propst wrote in message ...
> On the subject of setting object variables to nothing when they're no longer
> needed, I have looked at many help file code examples on diff subjects and
> not found any that follow that rule. Is that intentional to teach us
> beginners bad programming manners?
>
> --
> related ques: is this a different case?
> Function MirrorObjSet(objSet, mirrptarr)
>
> Dim obj1 As AcadEntity
>
> For Each obj1 In objSet
> ...do something with obj1...
> next obj1
> end sub
>
> Here, obj1 was never set using the 'Set' command?/keyword?/function?
> so does it still need set to nothing at the end or is this different?
>
> [email protected]
> A.T. Renczarski and Co., inc.
> p 816.587.0101
> f 816.587.5691
>

----------------------------------------
Sender IP : 208.225.248.186
Sender Host : no reverse DNS for this IP

Posted by newsgroup Xplorer : http://connect.to/newsgroup | http://www.newsgroupxplorer.com
0 Likes
Message 3 of 5

Anonymous
Not applicable
Thanks again for answering,

Frank Oquendo wrote in message
news:[email protected]...
> Hi Mark. Tis example is indeed a bit different. When using For Next to
iterate a set of objects,
> the iterator is automatically pointed at the next object in the
collection.

So an iterator even tho it points to an object does not need to be set =
nothing
after pointing to the last object in the collection it doesn't remain stuck
there, it goes out of scope automatically like and int or double etc
variable?

Mark
0 Likes
Message 4 of 5

Anonymous
Not applicable
> So an iterator even tho ...

That's correct. One thing to keep in mind is that you can't ever go
wrong by setting an object to Nothing so long as it's an object you
created. So even though you don't *have* to clear the iterator object
(or any other object for that matter), it's perfectly ok to do so.

--
http://www.acadx.com
"You keep using that word. I do not think it means what you think it
means."

"Mark Propst" wrote in message
news:[email protected]...
> Thanks again for answering,
>
> Frank Oquendo wrote in message
> news:[email protected]...
> > Hi Mark. Tis example is indeed a bit different. When using For
Next to
> iterate a set of objects,
> > the iterator is automatically pointed at the next object in the
> collection.
>
> So an iterator even tho it points to an object does not need to be
set =
> nothing
> after pointing to the last object in the collection it doesn't
remain stuck
> there, it goes out of scope automatically like and int or double etc
> variable?
>
> Mark
>
0 Likes
Message 5 of 5

Anonymous
Not applicable
Thank You.
0 Likes