Many programming languages have the print() function or operator to output text into the screen.

In JavaScript the story is different.

Since it was created to manipulate HTML documents in the browser, the output-to-screen function was document.write() (was because it’s no longer recommended to be used — instead, you should manipulate the Document Object Model).

There are also the alert() function (a method on the window object), which will display a dialog, and console.log(), which will write the output into the developer console.

The print() function is also there, but instead of writing to the screen, it sends the document to the printer! Or, rather, it causes the printing dialog to pop up. This can be confusing for novice users, and makes the “Hello world” program look different from most other languages.

Since Calcish doesn’t use DOM, we took the print() function back — in Calcish it will write the arguments into the screen (specifically, to the output part of the evaluation result). To send Calcish documents to a printer, just use the menu.

print function in Calcish

The only downside is that after hours of tinkering in Calcish, I sometimes write print() in the browser’s JavaScript instead of console.log(), getting the nasty print dialog. Of course, we’ll also support console.log(), so if you chose not to use print(), you’re free to do so.