Sha256: 6f2218cda8e76345bc987da5bcc2da4346914de132c4a38f7b50ecb165bdb54c

Contents?: true

Size: 808 Bytes

Versions: 10

Compression:

Stored size: 808 Bytes

Contents

To generate a document that shows the text "Hello world!":

%!PS
/Helvetica 20 selectfont
70 700 moveto
(Hello world!) show
showpage

If the viewer has a console, then there are the following ways to display the topmost element of the stack:

(Hello world!) ==

will display the <i>string</i> "(Hello world!)";

(Hello world!) =

will display the <i>content</i> of the string "(Hello world!)"; that is, "Hello world!";

(Hello world!) print

will do the same, without printing a newline. It may be necessary to provoke an error message to make the console pop up. The following program combines all four above variants:

%!PS
/Helvetica 20 selectfont
70 700 moveto
(Hello world!) dup dup dup
= print == % prints three times to the console
show % prints to document
1 0 div % provokes error message
showpage

Version data entries

10 entries across 7 versions & 1 rubygems

Version Path
zettacode-0.1.7 files.zettacode/hello_world.text/postscript.txt
zettacode-0.1.6 files.zettacode/hello_world.text/postscript.txt
zettacode-0.1.6 files.zettacode2/hello_world.text/postscript.txt
zettacode-0.1.5 files.zettacode/hello_world.text/postscript.txt
zettacode-0.1.5 files.zettacode2/hello_world.text/postscript.txt
zettacode-0.1.4 files.zettacode/hello_world.text/postscript.txt
zettacode-0.1.4 files.zettacode2/hello_world.text/postscript.txt
zettacode-0.1.3 files.zettacode/hello_world.text/postscript.txt
zettacode-0.1.2 files.zettacode/hello_world.text/postscript.txt
zettacode-0.1.1 zettacode.files/hello_world.text/postscript.txt