From: daniel Date: 2003-03-28T07:35:33+09:00 Subject: Re: i++ Brian Candler schrieb in im Newsbeitrag: 20030327220909.GA71406@uk.tiscali.com... > On Fri, Mar 28, 2003 at 06:54:58AM +0900, daniel wrote: > > my code in ruby looks like this... > > -- > > i=0 > > arr_stuff.each { > > |a| > > $tk_listbox_stuff.insert( i, a.to_s) > > i += 1 > > } > > -- > > > > I really love the c++ style with > > ++i > > or > > i++ > > > > Is there a smart way to do such things in ruby? > > In the above example there's an even smarter way: > > arr_stuff.each_with_index { |a,i| > $tk_listbox_stuff.insert( i, a.to_s) > } > > Neat, huh thx for this answer! - its great!