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 »

2 Responses to “Check for Existence of a Variable in MEL”

  1. Scott Says:

    here is one for you: http://www.youtube.com/watch?v=fElE-LFep9w

  2. zoomy Says:

    Lovely. Thanks!

Leave a Reply