Skip to main content

Notice: This Wiki is now read only and edits are no longer 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"

(New page: EGL provides general statements, as well as "action statements" that are used for interacting with an external data source. General statements Case The case statement never runs more th...)
 
Line 1: Line 1:
EGL provides general statements, as well as "action statements" that are used for interacting with an external data source.
+
EGL provides general statements, as well as statements that are used for interacting with an external data source.  
  
General statements
+
= General statements =
  
Case
+
== Case ==
  
 
The case statement never runs more than one clause:  
 
The case statement never runs more than one clause:  
  
* The first form of the statement tests a criterion value. The following example invokes <code>mySecondFunction</code> if the field value is 2, 3, or 4:  
+
*The first form of the statement tests a criterion value. The following example invokes <code>mySecondFunction</code> if the field value is 2, 3, or 4:
  
 
<source lang="java">case (myRecord.requestID)
 
<source lang="java">case (myRecord.requestID)
Line 17: Line 17:
 
       myDefaultFunction();
 
       myDefaultFunction();
 
end   
 
end   
</source>
+
</source>  
  
* The second form of the statement executes the first clause that resolves to true. The following example displays only "x passes":
+
*The second form of the statement executes the first clause that resolves to true. The following example displays only "x passes":
  
 
<source lang="java">
 
<source lang="java">

Revision as of 12:03, 13 February 2012

EGL provides general statements, as well as statements that are used for interacting with an external data source.

General statements

Case

The case statement never runs more than one clause:

  • The first form of the statement tests a criterion value. The following example invokes mySecondFunction if the field value is 2, 3, or 4:
case (myRecord.requestID)
   when (1)
      myFirstFunction();
   when (2, 3, 4)
      mySecondFunction();      
   otherwise
      myDefaultFunction();
end
  • The second form of the statement executes the first clause that resolves to true. 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

Back to the top