Hello, World!

The title, “Hello, World!” is especially appropriate for a blog about a programming language. After all, the phrase comes from books about programming languages.

I’ll expand this post later, but for now, without further ado, here is the canonical “Hello, World!” program in BOOL:

@@main
.   print: "Hello, World!" ;

That is the simplest version possible.

What the code above does is create a new BOOL “Action”, called “@main”. By default, when BOOL runs a program it looks for a start-up Action according to a list of known names. The first name on the list is “@main”.

The @main action contains a list of objects to execute. In this case, there is just one item on the list, a “print:” Message, which has a string literal as its target. The print: Message is monadic, so there are no argument objects.

The print: Message tells the string to print itself to the default output.

Advertisements
%d bloggers like this: