Skip to main content



      Home
Home » Modeling » M2T (model-to-text transformation) » Incremental for loop
Incremental for loop [message #1753437] Mon, 06 February 2017 08:18 Go to next message
Eclipse UserFriend
Hye everyone,

Can everyone can explain me (I'm new on Acceleo) how to do this with acceleo syntax :

for(int i = 0; i < X && Y > Z; i++){
...
}

I have seen syntax of for loop for acceleo which use a collection as input. But for me i want to write a piece of code X times so i want an incremental and conditional for loop to do this.

Is it possible and if yes, how to do this?

Thank you for your responses!

Re: Incremental for loop [message #1753559 is a reply to message #1753437] Tue, 07 February 2017 12:27 Go to previous messageGo to next message
Eclipse UserFriend
Hi

Maybe there is a typo since Y and Z seem nothing to do with the loop.

Sequence{1..X}->forAll(i | ...)

is a useful idiom for a loop.

Regards

Ed Willink
Re: Incremental for loop [message #1754107 is a reply to message #1753559] Tue, 14 February 2017 09:49 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Thank your for your response,

I didn't know this Sequence create syntax. And actually, with this syntax it is possible to create an incremental loop like that :

[let maxCount : Integer = 20]
    [for aValue : Integer | Sequence{0..maxCount}]
        coucou : [aValue/]
    [/for]
[/let]


Thank you very much! Subject Resolved!
Re: Incremental for loop [message #1754108 is a reply to message #1753559] Tue, 14 February 2017 09:49 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Thank your for your response,

I didn't know this Sequence create syntax. And actually, with this syntax it is possible to create an incremental loop like that :

[let maxCount : Integer = 20]
    [for aValue : Integer | Sequence{0..maxCount}]
        coucou : [aValue/]
    [/for]
[/let]


Thank you very much! Subject Resolved!
Re: Incremental for loop [message #1754109 is a reply to message #1753559] Tue, 14 February 2017 09:50 Go to previous message
Eclipse UserFriend
Hi,

Thank your for your response,

I didn't know this Sequence create syntax. And actually, with this syntax it is possible to create an incremental loop like that :

[let maxCount : Integer = 20]
    [for aValue : Integer | Sequence{0..maxCount}]
        coucou : [aValue/]
    [/for]
[/let]


Thank you very much! Subject Resolved!
Previous Topic:[Acceleo] Generation in one thread
Next Topic:[Acceleo] pb with java services
Goto Forum:
  


Current Time: Tue Jul 15 07:39:51 EDT 2025

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

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

Back to the top