Function Entry: PRINC

← Prev | ↑ Chapter | Next → | Index | Symbols

Function Entry: PRINC

Name

princ

Class

Function

Syntax

(princ [expression [fileHandle]])

Arguments and Values

  • expression (optional): any AutoLISP expression or value. If omitted, nil is used.
  • fileHandle (optional): handle of a file as obtained from (open …). If omitted or nil, output goes to the command line.

Description

Prints expression to the command line, or writes it to the open file fileHandle. The representation is display-oriented: unlike prin1, control characters in a string expression are written verbatim (no \n / \t / escaped-double-quote rewriting). With no argument, (princ) returns the void symbol value and is the conventional way to terminate a defun without emitting anything.

Return Values

Returns the evaluated value of expression, or void with no argument.

Side Effects

Writes the printed representation to the command line or to fileHandle.

Examples

With (setq x 123):

  • (princ x) prints 123 to the command line and returns 123.
  • (princ x fh) writes 123 to file handle fh and returns 123.

Tested Behaviour (BricsCAD V26 / macOS, 2026-04-26)

(princ "hello" file-desc) returns "hello" and writes the five characters hello to the file (no surrounding quotes, no trailing newline). Confirms the verbatim representation, distinct from prin1's round-trippable representation.

Availability

  • AutoCAD 2026: documented (Autodesk reference page).
  • BricsCAD V26: documented + product-tested on macOS (probe suite, 2026-04-26). 2-argument form accepted; output is verbatim (no escape rewriting).
  • Status: documented in both vendors and tested against BricsCAD V26 / macOS.

See Also