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.
EDT:Writing statements
Revision as of 12:05, 13 February 2012 by Unnamed Poltroon (Talk)
EGL provides general statements, as well as statements that are used for interacting with an external data source.
General statements
Case
The case statement has two form and never runs more than one clause:
- You can test 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
- You can test a set of logical expressions, running the first clause for which the criterion 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