[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] syntax for 'for loop'



What about just multiplying $j with the desired time-increment?

So :
$ns at [expr $j * 0.5] "$cbr($i) start"

Onno


Raj M Verma wrote:

> hi, thanx a lot. but it's working only for integers.
> suppose if I wana increment the time by 0.5 sec, then
> I'm not able to use real numbers in this for loop. so
> pls lemme know whether and how we can use real numbers
> in for loops. thanx.
> Raj.
>
> --- "Marcos \"Locksmith\" Portnoi" <[email protected]>
> wrote:
> > How about nested loops?  Such as:
> >
> > set j 1
> > for {set i 0} {$i < 5} {incr i} {
> >     $ns at $j "$cbr($i) start"
> >     incr j
> > }
> >
> > Portnoi
> > ----- Original Message -----
> > From: "Raj M Verma" <[email protected]>
> > To: "users ns" <[email protected]>
> > Sent: Thursday, 30 de August de 2001 12:44
> > Subject: [ns] syntax for 'for loop'
> >
> >
> > > I wana start some CBR traffics at a certain point
> > of
> > > time then I can use the loop as follows.
> > >
> > > for {set i 0} {$i < 5} {incr i} {
> > >     $ns at 1.0 "$cbr($i) start"
> > > }
> > >
> > > so here all CBRs are gonna start at 1.0, but if I
> > wana
> > > start them at diff points of time, like cbr(0) at
> > 1.0,
> > > cbr(1) at 2.0 and so on, I shud use one more
> > variable
> > > for incrementing the time. my prob is how and
> > where
> > > shud I use the other variable. pls lemme know the
> > > syntax. thanx.
> > > Raj.
>
> __________________________________________________
> Do You Yahoo!?
> Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
> http://im.yahoo.com