Prints an expression to the command line or writes an expression to an open file

(prin1 [expr [file-desc]])



A string or AutoLISP expression. Only the specified expr is printed; no newline or space is included.


A file descriptor for a file opened for writing.

Return Values

The value of the evaluated expr. If called with no arguments, prin1 returns a null symbol.

Used as the last expression in a function, prin1 without arguments prints a blank line when the function completes, allowing the function to exit “quietly.”


Command: (setq a 123 b '(a))


Command: (prin1 'a)


The previous command printed A and returned A.

Command: (prin1 a)


The previous command printed 123 and returned 123.

Command: (prin1 b)


The previous command printed (A) and returned (A).

Each preceding example is displayed on the screen because no file-desc was specified. Assuming that f is a valid file descriptor for a file opened for writing, the following function call writes a string to that file and returns the string:

Command: (prin1 "Hello" f)


If expr is a string containing control characters, prin1 expands these characters with a leading \, as shown in the following table:

Control codes




\ character


" character


Escape character


Newline character


Return character


TAB character


Character whose octal code is nnn

The following example shows how to use control characters:

Command: (prin1 (chr 2))


See Also