Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xpand] iteration over integer list
[Xpand] iteration over integer list [message #629152] Mon, 27 September 2010 11:23 Go to next message
Stephan Krusche is currently offline Stephan KruscheFriend
Messages: 18
Registered: August 2010
Location: Munich
Junior Member

I have an attribute length in my type element which is of type integer. Now I want to generate the following code, where n is the value of length.


How can i do that? My suggestion was to use a built-in function that generates a List[int] and to iterate over it with FOREACH. But I only know the following operation which only inserts 0 and n into the list:

«FOREACH {'0', element.length} AS i»

Is there also a mechanism to insert all values between 0 and n into that list? (e.g. like in python the following code "for i in range(0, n):")

Re: [Xpand] iteration over integer list [message #629309 is a reply to message #629152] Mon, 27 September 2010 18:35 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14656
Registered: July 2009
Senior Member
Hello Stephan,

yes this is possible

«FOREACH 0.upTo(10) AS i»


Twitter : @chrdietrich
Blog :
Previous Topic:[Announce] Demonstrations at ESE's Modeling Symposium
Next Topic:XPand template not working after upgrading to Helios
Goto Forum:

Current Time: Mon Mar 04 15:41:36 GMT 2024

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

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

Back to the top