Go to: Synopsis. Return value. Related. MEL examples.

Synopsis

print <int | float | string | vector | matrix | array>

print is undoable, queryable, and editable.

The print command displays its argument in the Script Editor (or in standard output in batch mode). If the argument is not a string it is converted to one. New lines are not automatically appended to output.

Return value

None

In query mode, return type is based on queried flag.

Related

fprint

MEL examples

// To print a scalar (int, float, string):

$i=42;
print $i;
// 42

$f=3.14159;
print $f;
// 3.14159

$s="Hello There";
print $s;
// Hello There

// To print a vector:

vector $v;
$v=<<1.2, 2.3, 3.4>>;
print $v;
// 1.2 2.3 3.4

// To print a matrix:

matrix $m[2][3]=<<3.14159, 2.3456781232131, 1; 4.561234586903, 5.342143, 42>>;
print $m;
// << 3.14159, 2.345678123, 1;
//    4.561234587, 5.342143, 42 >>

// To print an array:

string $a[];
$a=`ls -lights`;
print $a;
// ambientLightShape1
// directionalLightShape1
// pointLightShape1
// pointLightShape2

// To construct a string argument for the print command, use the
// + operator to concatenate elements of that string.
// Note that parentheses are required around expressions which
// form a single command argument.

print ("$i="+ $i + ", $f="+$f+"\n");
// $i=42, $f=3.14159