Check for Existence of a Variable in MEL

June 16th, 2011

Error-catching in MEL with the catch command won’t catch a “variable does not exist” error, so use whatIs instead:

if (`whatIs "$test"` == "Unknown") {
print "yes";
} else {
print "no";
}

There ya go.

« previously: First, some whinging | Home | next: MakerBot construction timelapse »