Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EDT:Writing statements"

Line 1: Line 1:
EGL provides general statements such as if and while, as well as action statements for accessing data sources and for invoking external logic.
+
EGL provides general statements such as if and while, as well as action statements for accessing data sources and for invoking external logic.  
  
= General statements =
+
= General statements =
  
The general statements are case, continue, exit, for, if, move, return, throw, transfer, try, use, and while.
+
The general statements are case, continue, exit, for, if, move, return, throw, transfer, try, use, and while.  
  
 
== Case  ==
 
== Case  ==
Line 50: Line 50:
 
As shown, no more than one clause ever executes. Control does not “fall through” from one clause to the next.<br>  
 
As shown, no more than one clause ever executes. Control does not “fall through” from one clause to the next.<br>  
  
 +
<br>
  
== Continue ==
+
== Continue ==
  
 +
== Exit  ==
  
 +
<br>
  
Exit
+
== For  ==
  
 +
<br>
  
 +
== If  ==
  
For
+
<br>
  
 +
== Move  ==
  
 +
<br>
  
If
+
== Return  ==
  
 +
<br>
  
 +
== Throw  ==
  
Move
+
== <br> Try  ==
  
 +
<br>
  
 +
== Use  ==
  
Return
+
<br>
  
 +
== While  ==
  
 +
<br>
  
Throw
+
= Action statements  =
  
 +
The action statements are add, call, close, delete, execute, forEach, get, open, prepare, and transfer.<br>
  
Transfer
+
== Add  ==
  
 +
== Call ==
  
Try
+
== Close  ==
  
 +
== Delete  ==
  
 +
== Execute  ==
  
Use
+
== ForEach  ==
  
 +
== Get  ==
  
 +
== Open  ==
  
While
+
== Prepare  ==
  
 +
== Replace  ==
  
 
+
== Transfer ==
Action statements
+
 
+
 
+
 
+
Add
+
 
+
Close
+
 
+
Delete
+
 
+
Execute
+
 
+
ForEach
+
 
+
Get
+
 
+
Open
+
 
+
Prepare
+
 
+
Replace
+

Revision as of 13:52, 13 February 2012

EGL provides general statements such as if and while, as well as action statements for accessing data sources and for invoking external logic.

General statements

The general statements are case, continue, exit, for, if, move, return, throw, transfer, try, use, and while.

Case

The case statement responds to conditions at run time by executing one set of statements rather than another:

  • You can test a criterion value. The following example invokes mySecondFunction:
function test()
   x Int = 3; 
 
   case (x)
      when (1)
         myFirstFunction();
      when (2, 3, 4)
         mySecondFunction();      
      otherwise
         myDefaultFunction();
   end   
end
  • You can test a set of logical expressions. The following example displays only "x passes":
function test()
   x Int = 3;
   y Int = 5;
   z Int = 7;
 
   case
      when (x == 3)
         SysLib.writeStdOut("x passes");
      when (y == 5)
         SysLib.writeStdOut("y passes");
      when (z == 7)
         SysLib.writeStdOut("z passes");
      otherwise
         SysLib.writeStdErr("You will not see this message.");
      end
   end 
end

As shown, no more than one clause ever executes. Control does not “fall through” from one clause to the next.


Continue

Exit


For


If


Move


Return


Throw


Try


Use


While


Action statements

The action statements are add, call, close, delete, execute, forEach, get, open, prepare, and transfer.

Add

Call

Close

Delete

Execute

ForEach

Get

Open

Prepare

Replace

Transfer

Back to the top