Wednesday, August 7, 2013

ELENA 2.0: Hello World Tutorial

In our first ELENA 2.0 tutorial let’s create a simple console program.

First we have to create a new project: File - New - Project. In the open dialog we have to select: Project type – console; Namespace – example1; Target file name – example1 and press OK.

Next let’s create a source file: File – New – Source File

Before continue we have to save it: File – Save All (IDE will ask if the new module should be included into the project – press Yes).

Now we are going to write our program. We will start with declaring the program main body – code symbol:

symbol program =
[
].

To print the message we have to send the message writeLine to system’console symbol:

system’console writeLine:”Hello World”.

After that we will wait for the user action.

system’console readChar.

Let’s make a simple optimization. We could declare system namespace so no need to write it every time. So our program looks like this:

symbol program =
[
    console writeLine:"Hello World".
    
    console readKey.
].

Before compiling the project we have to assign the program entry to our symbol. So select Project – Forwards…

In the open dialog enter the following line : 'program=example1'program, press Add and Save. (Starting from 1.9.24 this is no longer required. It is enough to declare program closure in the root name space)

Now we can run our program: Debug – Run.