Category:Elena: Difference between revisions

Line 14:
== The simplest program ==
 
To create a simple console program we have to declare the **program** symbol in the project root namespace:
 
program =
Line 20:
].
 
Everything in ELENA is an object. To interact with it we have to send a message. The simplest (*generic*, i.e. without an explicit signature) message consists of *an action* and a *parameter list*.
 
The statement should be terminated by a dot (*ELENA is inspired by Smalltalk and uses its syntax notations*).
 
program =
Line 29:
].
 
In our example the action is ~writeLine~ and the parameter list consists of a single literal constant. The message target is ~console~ object (implementing input / output operations with a program console).
 
Several message operations can be done in a single statement separated by a semicolon:
Line 43:
How are you?
 
We may read a user input by sending **readLine** message without parameters:
 
program =
Line 55:
Hello Alex
 
_ConsoleConsole::write_write method is similar to _writeLine_writeLine except that it writes to the output screen without a new line character.
 
== Declaring a variable ==
Anonymous user