help/doc: use of multiple loop iterators

4 views
Skip to first unread message

Guy Hutchison

unread,
Mar 11, 2010, 8:17:42 PM3/11/10
to omnetpp
Hi,

I tried to create a network for a fully connected mesh following the
examples from the documentation, but I get a syntax error in the NED
file. The syntax

for i=0..conns-1, j=0..conns-1 {
...

gives a syntax error. As far as I can tell this is the same syntax
as presented in section 3.10 of the documentation. Is there some
magic bit of syntax I am missing?

Thanks,

Guy

Full code:
network twoloops
{
parameters:
int conns;
@display("bgb=299,200");
submodules:
source[conns]: Source {
@display("p=45,69,column,60");
}
sink[conns]: Sink {
@display("p=252,69,column,60");
}
classifier[conns]: Classifier {
@display("p=149,69,column,60");
}
connections allowunconnected:
for i=0..conns-1 {
source[i].out --> classifier[i].in++;
}
for i=0..conns-1, j=0..conns-1 {
classifier[i].out++ --> sink[j].in++;
}
}

Andras Varga

unread,
Mar 12, 2010, 3:30:27 AM3/12/10
to omn...@googlegroups.com
Add "for" in front of "j" as well:
for i=0..conns-1, for j=0..conns-1 {

I fixed the examples in the docu. Thanks!
Andras

Hi,

for i=0..conns-1, j=0..conns-1 {
...

Thanks,

Guy

--
You received this message because you are subscribed to the Google Groups
"omnetpp" group.
To post to this group, send email to omn...@googlegroups.com.
To unsubscribe from this group, send email to
omnetpp+u...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/omnetpp?hl=en.

Reply all
Reply to author
Forward
0 new messages