Yes. It's done as "||".
string sTag = GetTag(oItem); /* I do this here to avoid redundant calls to get the item's tag. */
if (sTag != "item1" || sTag != "item2")
{
DestroyObject(oItem);
}
So...if the tag does not equal "item1", destroy the item.
or it the tag does not equal "item2", destroy the item.
Looks like the item is getting destroyed no matter what.
-------------------------------------
There is also a version of AND. It's done as "&&". And it sounds closer to what it looks like you want in your code snippet, since both conditions need to be met for the item to be destroyed, rather than just one of them.
string sTag = GetTag(oItem); /* I do this here to avoid redundant calls to get the item's tag. */
if (sTag != "item1" && sTag != "item2")
{
DestroyObject(oItem);
}
If the tag does not equal "item1" and the tag does not equal "item2", then destroy the item.
Modifié par The Amethyst Dragon, 27 février 2011 - 03:58 .