Anonymous user
Category:Elena: Difference between revisions
no edit summary
No edit summary |
No edit summary |
||
Line 12:
ELENA is a general-purpose, object-oriented, polymorphic language with late binding. It features message dispatching/manipulation, dynamic object mutation, a script engine / interpreter and mix-ins.
== The simplest program ==
To create a simple console program we have to declare the **program** symbol in the project root namespace:
Line 58 ⟶ 57:
**Console::write** method is similar to **writeLine** except that it writes to the output screen without a new line character.
== Declaring a variable ==
A variable can be declared in an assignment statement starting with **var** attribute:
Line 131 ⟶ 129:
system'startUp(5)
== Basic Types ==
=== The Boolean Type ===
Boolean type is used in conditional operations and may accept only two Boolean literals - **true** and **false**.
Line 161 ⟶ 157:
false==true is false
The most used numeric types in ELENA are 32-bit signed integer number (represented by **IntNumber**), 64-bit signed integer number (represented by **LongNumber**) and 64-bit floating-point number (represented by **RealNumber**):
Line 184 ⟶ 180:
Real number - 2.3456
**LiteralValue** is used to store the text encoded in UTF-8. LiteralValus is read-only collection of **CharValue** classes each representing UTF-32 symbol. *Note that one character may be encoded with more than one byte!*.
Line 263 ⟶ 259:
The last character of Привет is т
It is possible to declare a dynamic or static array.
Line 286 ⟶ 282:
dynamic array 1,b,2.3
ELENA supports basic arithmetic operations with integer and floating-point numbers:
Line 315 ⟶ 311:
12 + 5 * 2.3 = 23.5
Conditional statement in ELENA are defined as follows:
Line 390 ⟶ 386:
].
Everything in ELENA is a class. So to implement some tasks we will have to declare our own classes.
Let's create a simple class :
Line 432 ⟶ 428:
*Note that in ELENA a class is an object itself and can be used by like any other object*
We may inherit our class. When the parent is not explicitly declared - the class inherits *system'Object* super class
Line 483 ⟶ 479:
I'm a Child Class.
It is possible to declare the private methods which cannot be called outside the class.
Line 528 ⟶ 524:
system'startUp(5)
In normal case the class fields cannot be accessed outside the class. That's why we may declare a special method to access it:
Line 577 ⟶ 573:
].
We may use try-catch statement to handle the possible exceptions:
|