PDA

View Full Version : Quick Mel Question


FluidEdge
09-26-2010, 05:57 PM
What is the difference between the ` apostrophe and ' apostrophe in MEL? Thnaks

NaughtyNathan
09-26-2010, 07:11 PM
the ` is not actually an apostrophe, it's called "backtick" and it's a special character that denotes to MEL that you want the return value (Result) of the code within. e.g.

string $selection[] = `ls -sl`;the ' is simply a standard single quote/apostrophe charater and has absolutely no special significance in MEL whatsoever. the ' is only ever used in MEL as a standard character in user strings. e.g.

string $literal = "Don't have a cow Man!";:nathaN

ewerybody
10-06-2010, 01:58 PM
in py however the ' is used as quotation mark but can be exchanged to the " as well. Is that correct Nathan?var1 = 'some text'
var2 = "some text"
if var1 == var2:
print 'yep its the same!'

var3 = 'you can "quote" without escaping!'
var4 = "you can 'quote' without escaping!"
# does NOT work of course:
var5 = "you can "quote" without escaping!"
var6 = 'you can 'quote' without escaping!'

Byterunner
10-06-2010, 04:59 PM
This should go without saying, but for completeness, they are only exchangeable in pairs.
# okay:
var1 = 'some text'
var2 = "some text"
#not okay:
var3 = 'some text"
var4 = "some text'

CGTalk Moderation
10-06-2010, 04:59 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.