# printer statement

The printer statement controls the output
from subsequent print, heading, footing, or page statements.

## Syntax

```
 printer [on|off|close|num.exp]
```

## Parameter(s)

| on | Directs output to the system printer, via the spooler. |
| --- | --- |
| off | Directs output from subsequent print statements to the terminal. |
| close | Indicates that the current (printer) output is completed. This closes all open spooler entries generated by the current process, and releases control of the print jobs to the spooler. printer close is implicit when the FlashBASIC or BASIC program stops and returns to TCL, or the calling Proc or executing program. |
| num.exp | Evaluates as follows: |
| -1 | Printer close. |
| 0 | Printer off. |
| >=1 | Printer on. |

## Example(s)

**Example 1**

In this example, the first string
displays, print output is turned on, and the second string is sent
to the spooler.

```
 print ’press Enter to begin printing’
 printer on
 print ’this is the first line’
```
The printer is turned on if the variable answer is the
letter y.

```
 crt ’print? ’:;input answer
 printer (answer=’y’)
```
This section turns off the printer to display an error
message and prompt for operator intervention. When the printer is
turned back on, output is appended to the currently open spooler file.

```
 printer on
 print rec<5>
 if rec<6>=’’ then
 printer off
 print ’error in attribute 6’
 print ’press Enter to continue ’:
 input continue
 printer on
 end
```

 **Example 2**

In this example, a single section of a larger program
sends output to the spooler, closes the job when finished, and continues
execution of the program.

```
 10 *
 print ’do you want to print? ’:
 input ans
 if ans # ’y’ then stop
 printer on
 print ’the amount is ’:amount
 print...
 ...
 printer close
 printer off
 goto 10
```

## See also

- [crt statement](https://d3codex.com/pickbasic-flashbasic/crt-statement/)
- [crt-device command](https://d3codex.com/tcl/crt-device-command/)
- [footing statement](https://d3codex.com/pickbasic-flashbasic/footing-statement/)
- [heading statement](https://d3codex.com/pickbasic-flashbasic/heading-statement/)
- [page statement](https://d3codex.com/pickbasic-flashbasic/page-statement/)
- [print on statement](https://d3codex.com/pickbasic-flashbasic/print-on-statement/)
- [print statement](https://d3codex.com/pickbasic-flashbasic/print-statement/)
- [Statements and functions](https://d3codex.com/pickbasic-flashbasic/statements-and-functions/)
- [u0193 user exit](https://d3codex.com/proc/u0193-user-exit/)
- [u3193 user exit](https://d3codex.com/proc/u3193-user-exit/)
- [u4193 user exit](https://d3codex.com/proc/u4193-user-exit/)
- [u61bc user exit](https://d3codex.com/proc/u61bc-user-exit/)

---
Source: https://d3codex.com/pickbasic-flashbasic/printer-statement/ - part of the D3Codex reference.
