Category:Elena: Difference between revisions

Content added Content deleted
Line 14: Line 14:
== The simplest program ==
== The simplest program ==


To create a simple console program we have to declare the **program** symbol in the project root namespace:
To create a simple console program we have to declare the program symbol in the project root namespace:


program =
program =
Line 20: 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*.
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*).
The statement should be terminated by a dot (ELENA is inspired by Smalltalk and uses its syntax notations).


program =
program =
Line 29: 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).
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:
Several message operations can be done in a single statement separated by a semicolon:
Line 43: Line 43:
How are you?
How are you?


We may read a user input by sending **readLine** message without parameters:
We may read a user input by sending readLine message without parameters:


program =
program =
Line 55: Line 55:
Hello Alex
Hello Alex


_Console::write_ method is similar to _writeLine_ except that it writes to the output screen without a new line character.
Console::write method is similar to writeLine except that it writes to the output screen without a new line character.


== Declaring a variable ==
== Declaring a variable ==