defined

defined

Returns true if the object is defined, returns false otherwise.

Example
if (defined(positions)) {
     doSomething();
} else {
     doSomethingElse();
}
Source: