[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmt] Re: [MOFScript]i+=1 acturally add by two

Hello Ye,

This sounded strange.........

The following transformation gives tho output output below on my computer:

uml.Model::main () {
var l1:List
var l2:List
var counter:Integer = 5
counter->forEach(n){
l1.add(n+" : l1")
l2.add(n+" : l2")
}
var counter2:Integer = 0
while(counter2 < l1.size() || counter2 < l1.size()){
if ( l1.get(counter2)!=null ){
stdout.print("List 1: "+l1.get(counter2))
}
if ( l2.get(counter2)!=null ){
stdout.print(" - List 2: "+l2.get(counter2))
}
stdout.println("")
counter2 +=1
stdout.println("Hola: "+counter2)
}
}
}


## Executing MOFScript Specification
## Starting transformation: "ExampleTransformation"
List 1: 1 : l1 - List 2: 1 : l2
Hola: 1
List 1: 2 : l1 - List 2: 2 : l2
Hola: 2
List 1: 3 : l1 - List 2: 3 : l2
Hola: 3
List 1: 4 : l1 - List 2: 4 : l2
Hola: 4
List 1: 5 : l1 - List 2: 5 : l2
Hola: 5
## Finished transformation: "ExampleTransformation"


So how you manage to make it add 2, I do not know.

/Gøran


"yeliu " <yeliu@xxxxxx> wrote in message 
news:f9de9ff6c267a0d3a1dfb62f7ba79a02$1@xxxxxxxxxxxxxxxxxx
> Hello,
>  I found that i+=1  add by 2 instead of 1,How to write it add by 1?
>
>
> Thanks!
>
>
> Ye
>
>
>
>
>
>