You use the semicolon (;) in EAL to run multiple statements in order in one action, method implementation, or other expression that changes data.
Syntax
statement1;
statement2;
statement3
The semicolon separates one statement from the next. EAL evaluates the statements from left to right.
Use ; when one action must perform more than one change. Use := to assign a value; use = when you compare values.
Write a sequence of EAL statements
For example, this EAL expression sets three properties on the current object:
self.SomeDateTime := DateTime.Now;
self.SomeInt := 27;
self.SomeString := self.SomeDateTime.ToString('yyyy-MM-dd')
The statements run in this order:
SomeDateTimereceives the current date and time.SomeIntreceives27.SomeStringis calculated from the value assigned toSomeDateTime.
This ordering matters. The third statement can use the value established by the first statement because the first statement has already run.
Use the semicolon only between statements
A semicolon must have a statement on both sides. Do not put a semicolon after the final statement.
| Expression | Result |
|---|---|
'a string'; 0
|
Valid sequence. Its resulting type is Integer because 0 is the final statement.
|
'a string'; 0;
|
Invalid. The final semicolon tells the parser to expect another statement, but none follows. |
In a sequence, the final statement determines the sequence's resulting type. In the example above, 'a string'; 0 has type Integer.
Where you can use it
Use EAL sequences where MDriven accepts an expression that changes data, including:
- An Action execute expression.
- A ViewModel column Execute expression.
- A class method implementation.
- A StateMachine effect.
For example, a class method can create or update state through several assignments in one method body. Keep dependent assignments in the order in which they must execute.
Semicolon versus OCL expressions
OCL is used to query, calculate, and express constraints. EAL uses the same syntax as OCL where applicable, but adds the semicolon separator so that you can stack statements that change data.
Do not use ; to combine Boolean conditions. For logical conditions, use the relevant Boolean operators, such as or and not.
