Ex1
if(Owner.Find(M.key)) return 1
Ex2
if(M.key in Owner) return 1
Thank You.
ID:167196
Apr 16 2006, 5:46 pm
|
|
Should I use Ex1 or Ex2
Ex1 if(Owner.Find(M.key)) return 1 Ex2 if(M.key in Owner) return 1 Thank You. |
Apr 16 2006, 5:53 pm
|
|
It depends on the circumstance, usually the second one works better because the 1st one can be null (I think) sometimes.
|
In response to Justin B
|
|
The first one crashes if the list is empty. Use the in operator - that's what it's for.
|
In response to Jp
|
|
Thanks alot.
|
Aside from what others have said, with the list.Find() crashing and whatnot, list.Find() also returns unnecessary information for the mere "is it in the list?" question---it returns the position of the object within the list.
Also, in the future, please refrain from using colored fonts. Black is quite the readable color(In addition, I once knew somebody that couldn't see blue at all). Hiead |
In response to Hiead
|
|
Well if they can't see blue, I sure hope they don't make games on BYOND.
|
In response to Y2kEric
|
|
Y2kEric wrote:
Well if they can't see blue, I sure hope they don't make games on BYOND. That addition was quite the minor one. The last thing I want is to start seeing spots from only reading blue text all day. Black is perfectly fine. Hiead |
In response to Hiead
|
|
Ok, well thanks for your all your help.
|