Hello, world!

The canonical starting point.

It’s almost obligatory to demonstrate how a language handles the task of printing out “Hello, world!”. Here’s the shortest “hello world” application possible in 8th™:

"Hello, world!\n" . bye

Note that you don’t have to write all sorts of declarations, and that the “string” declaration is just like you’re used to from C++ or Java. For details about what’s going on here, just download 8th and read the tutorials and manual and sample code. But we digress…

You can get a little fancier if you decide to wrap your code in a “word” (the equivalent of a “function” in other languages):

: hi "Hello, world!\n" . ;
hi bye

This will accomplish the same thing. You created a new “word” named “hi”, and afterwards invoked the phrase “hi bye”.

Another variation on the theme: the shortest GUI version of the same application:

"Hello, world!" g:say

This will put up a dialog-box with our message. It’s not a proper GUI application, but it does work.

And one last version: do all this just from the system’s command-line. Great for short scripts!

8th -e '"Hello, world!\n" . bye'