Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » How to exit the FOR LOOP
How to exit the FOR LOOP [message #486363] Thu, 17 September 2009 12:46 Go to next message
Omran  is currently offline Omran Friend
Messages: 21
Registered: July 2009
Junior Member
Dear All,

I have a for loop statement and under a specific condition I want to
"exit" or "break" or "quit" the loop.

Does this capability exist?
here is the code that I am working on

[for (vc:ViewColumn|mv.columns)]
[if (vc.oclIsTypeOf(ViewExpColumn))]
[let vec : ViewExpColumn = vc.oclAsType(ViewExpColumn)]
[if (vec.expression.trim().toUpper().startsWith('SUM') or
vec.expression.trim().toUpper().startsWith('AVG') or
vec.expression.trim().toUpper().startsWith('MAX') or
// I want here to exit the

Re: How to exit the FOR LOOP [message #486382 is a reply to message #486363] Thu, 17 September 2009 13:20 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1685
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Hi Omran,

There is no such functionality in either Acceleo or OCL. However what
you seek seems like the "exists" collection iterator to me (and yes,
"exists" does shortcut the evaluation if an element fulfills the condition).

[if (mv.columns->select(oclIsTypeOf(ViewExpColumn))->exists(let exp :
String = expression.trim().toUpper() in exp.startsWith('SUM') or
exp.startsWith('AVG') or exp.startsWith('MIN') or exp.startsWith('MAX')
or exp.startsWith('COUNT')))]

Laurent Goubet

Omran a
Previous Topic:[Acceleo] Downcasting issue again
Next Topic:[Acceleo] Passing external parameter
Goto Forum:

Current Time: Tue May 31 12:16:47 GMT 2016

Powered by FUDForum. Page generated in 0.02936 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software