From: dblack@... Date: 2006-01-03T22:43:43+09:00 Subject: Re: could someone explain this CGI problem ? Hi -- On Tue, 3 Jan 2006, lg wrote: > the following code sequence > > cgi.div{ > 1..3.times{ |i| > cgi.div{ > "hello from div" > } > } > } > > produces > >
> 1..3 >
> > but i wanted to produce > >
>
> huhu >
>
> huhu >
>
> huhu >
>
> > could someone point me how to get the right result ? 1..3.times is being parsed as: 1..(3.times). Since times returns its receiver, that's the same as: 1..3 Try this: cgi.div { (1..3).map { cgi.div { "hello from div" # or "huhu", or whatever } } } You could also do: cgi.div { cgi.div { "hello from div" } * 3 } David -- David A. Black dblack@wobblini.net "Ruby for Rails", from Manning Publications, coming April 2006! http://www.manning.com/books/black