[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmt] Re: [MOFScript]print two list at the same time

Hello Ye,

The example bellow should give you a hint.

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
}
}
}

Cheers,
Gøran


"yeliu " <yeliu@xxxxxx> wrote in message 
news:240842b183b19c124f966fd188a1bc5e$1@xxxxxxxxxxxxxxxxxx
> Hello,
>  Now I have two list <String>,I want to show them at the same time,E.g
> list1[1]->List2[1]
> List1[2]->List2[2]
> Since in MOFScript,only one list could be printed once by using 
> List->forEach()
> How should I write this code in MOFScript?
>
>
>
> Many thanks!
>
>
> Ye
>
>