1) This has been bothering me for a while now.
if(%string != "test")
if(!(%string $= "test"))
Which of the two is the better option in terms of readability, syntax or function?
2) Occasionally, when I'm running through and checking values of objects, I will hit odd results on this:
new ScriptObject(TestObjectA)
{
Class = "TestClass";
Name = "Test Object A";
ValueImLookingFor = true;
}
new ScriptObject(TestObjectB)
{
Class = "TestClass";
Name = "Test Object B";
// Intentionally leaving out ValueImLookingFor
}
Function TestClass::valueimlookingfor(%this)
{
Return x ? Y : something I forgot the format
}
//leaving out packaging for sake of space
Function TestClass::doSomething(%this)
{
If(%this.valueimlookingfor())
//continue code
}
Regardless of the code errors that I intentionally put in there, is it safer to do %this.valueimlookingfor $= " " to check for objects that are under the same class as TestOBjectA but are missing that specific assigned value, or run a separate function to return true or false based on the variable's value or absence.