Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

print and format

print and format

Anonymous
Not applicable
211 Views
1 Reply
Message 1 of 2

print and format

Anonymous
Not applicable
Sometimes the output in the listener window is blue and sometimes it is black. Sometimes quotes appear around my text and sometimes not.

What determines these differences?

All my output code is the same

print "blah"
print "blah blah\n\n"
format "blah : %" myVar
format "blah : %\n" myVar
0 Likes
212 Views
1 Reply
Reply (1)
Message 2 of 2

Steve_Curley
Mentor
Mentor
Print always puts quotes around string output, format doesn't.
Print automatically outputs a single implied newline, format doesn't - you have to specify it/them.
Print only takes 1 parameter, format takes as many as you need, set by the number of "%" symbols in the Format string (the 1st parameter).

Also, print returns the final result of the print statement, which is why you see the result twice. Format returns "OK" if it works, which is why you see the result then an "OK".

Not sure about the black and blue - mine all seem to be blue.

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes