From: ahoward Date: 2003-03-28T07:35:25+09:00 Subject: Re: i++ On Thu, 27 Mar 2003, daniel wrote: > hello, > > 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? not preinc or postinc, but arr.size.times do |i| $tk_listbox_stuff.insert i, a[i].to_s end or arr.each_with_index do |a,i| $tk_listbox_stuff.insert i, a.to_s end -a -- ==================================== | Ara Howard | NOAA Forecast Systems Laboratory | Information and Technology Services | Data Systems Group | R/FST 325 Broadway | Boulder, CO 80305-3328 | Email: ahoward@fsl.noaa.gov | Phone: 303-497-7238 | Fax: 303-497-7259 ====================================