<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: The Basics of Ruby Arrays</title>
	<atom:link href="http://thinkvitamin.com/dev/ruby-arrays/feed/" rel="self" type="application/rss+xml" />
	<link>http://thinkvitamin.com/code/ruby-arrays/</link>
	<description>The Web Practitioner&#039;s Blog</description>
	<lastBuildDate>Sat, 11 Feb 2012 11:53:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: Ramnareshkk</title>
		<link>http://thinkvitamin.com/code/ruby-arrays/#comment-39987</link>
		<dc:creator>Ramnareshkk</dc:creator>
		<pubDate>Mon, 31 Jan 2011 05:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkvitamin.com/features/ruby/ruby-arrays#comment-39987</guid>
		<description>I want print all elements in a multi dimensional array. 
Is there any way to do it?</description>
		<content:encoded><![CDATA[<p>I want print all elements in a multi dimensional array.<br />
Is there any way to do it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Namtax</title>
		<link>http://thinkvitamin.com/code/ruby-arrays/#comment-37509</link>
		<dc:creator>Namtax</dc:creator>
		<pubDate>Sun, 14 Nov 2010 18:32:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkvitamin.com/features/ruby/ruby-arrays#comment-37509</guid>
		<description>Thanks for the run down, I am learning ruby and this will be very useful.</description>
		<content:encoded><![CDATA[<p>Thanks for the run down, I am learning ruby and this will be very useful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://thinkvitamin.com/code/ruby-arrays/#comment-37058</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Mon, 25 Oct 2010 10:02:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkvitamin.com/features/ruby/ruby-arrays#comment-37058</guid>
		<description>I like your blog and such a useful information sharing. I appreciate your blog and thanks for that.
- &lt;a href=&quot;http://drcsystems.com/magento-india/magento_development.php&quot; rel=&quot;nofollow&quot;&gt;Magento Templates&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>I like your blog and such a useful information sharing. I appreciate your blog and thanks for that.<br />
- <a href="http://drcsystems.com/magento-india/magento_development.php" rel="nofollow">Magento Templates</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: KW Variant 3</title>
		<link>http://thinkvitamin.com/code/ruby-arrays/#comment-36552</link>
		<dc:creator>KW Variant 3</dc:creator>
		<pubDate>Sun, 10 Oct 2010 08:40:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkvitamin.com/features/ruby/ruby-arrays#comment-36552</guid>
		<description>
The car&#039;s suspension system includes leaf springs, a stabilizer bar, a suspension arm, a shock absorber and/or MacPherson struts.</description>
		<content:encoded><![CDATA[<p>The car&#8217;s suspension system includes leaf springs, a stabilizer bar, a suspension arm, a shock absorber and/or MacPherson struts.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nirmik</title>
		<link>http://thinkvitamin.com/code/ruby-arrays/#comment-22601</link>
		<dc:creator>Nirmik</dc:creator>
		<pubDate>Thu, 02 Sep 2010 07:47:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkvitamin.com/features/ruby/ruby-arrays#comment-22601</guid>
		<description>it is really nice and useful</description>
		<content:encoded><![CDATA[<p>it is really nice and useful</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ET</title>
		<link>http://thinkvitamin.com/code/ruby-arrays/#comment-19053</link>
		<dc:creator>ET</dc:creator>
		<pubDate>Wed, 10 Mar 2010 18:39:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkvitamin.com/features/ruby/ruby-arrays#comment-19053</guid>
		<description>the previous two examples will start with the second element in the array.

if you want to print the first three elements of the array use this:

my_vitamins[0..2].each do &#124;vitamin&#124;
  puts “#{vitamin} is tasty!”
end</description>
		<content:encoded><![CDATA[<p>the previous two examples will start with the second element in the array.</p>
<p>if you want to print the first three elements of the array use this:</p>
<p>my_vitamins[0..2].each do |vitamin|<br />
  puts “#{vitamin} is tasty!”<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: karatedog</title>
		<link>http://thinkvitamin.com/code/ruby-arrays/#comment-17769</link>
		<dc:creator>karatedog</dc:creator>
		<pubDate>Thu, 14 Jan 2010 22:14:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkvitamin.com/features/ruby/ruby-arrays#comment-17769</guid>
		<description>An exhausting line-by-line example of inject: http://blog.jayfields.com/2008/03/ruby-inject.html</description>
		<content:encoded><![CDATA[<p>An exhausting line-by-line example of inject: <a href="http://blog.jayfields.com/2008/03/ruby-inject.html" rel="nofollow">http://blog.jayfields.com/2008/03/ruby-inject.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: karatedog</title>
		<link>http://thinkvitamin.com/code/ruby-arrays/#comment-17768</link>
		<dc:creator>karatedog</dc:creator>
		<pubDate>Thu, 14 Jan 2010 22:13:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkvitamin.com/features/ruby/ruby-arrays#comment-17768</guid>
		<description>With a little modification you can narrow down the full array before iterating through it.

my_vitamins[1..x].each do &#124;vitamin&#124;
puts “#{vitamin} is tasty!”
end</description>
		<content:encoded><![CDATA[<p>With a little modification you can narrow down the full array before iterating through it.</p>
<p>my_vitamins[1..x].each do |vitamin|<br />
puts “#{vitamin} is tasty!”<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: phattymatty</title>
		<link>http://thinkvitamin.com/code/ruby-arrays/#comment-16888</link>
		<dc:creator>phattymatty</dc:creator>
		<pubDate>Thu, 03 Dec 2009 16:36:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkvitamin.com/features/ruby/ruby-arrays#comment-16888</guid>
		<description>Thanks for posting this however it looks like you have an error in the inject example. I tried your example and kept getting the sum equal to the visit_count of the last item in the array. Instead of:

total_visits = stats.inject(0) {&#124;sum, stat&#124; sum  = stat.visit_count}

it should be (notice the  &quot;+&quot; in the block):

total_visits = stats.inject(0) {&#124;sum, stat&#124; sum  + stat.visit_count}

http://ruby-doc.org/core/classes/Enumerable.html#M003129 has the documentation for this. 

Again, thanks for posting...you got me headed in the right direction.</description>
		<content:encoded><![CDATA[<p>Thanks for posting this however it looks like you have an error in the inject example. I tried your example and kept getting the sum equal to the visit_count of the last item in the array. Instead of:</p>
<p>total_visits = stats.inject(0) {|sum, stat| sum  = stat.visit_count}</p>
<p>it should be (notice the  &#8220;+&#8221; in the block):</p>
<p>total_visits = stats.inject(0) {|sum, stat| sum  + stat.visit_count}</p>
<p><a href="http://ruby-doc.org/core/classes/Enumerable.html#M003129" rel="nofollow">http://ruby-doc.org/core/classes/Enumerable.html#M003129</a> has the documentation for this. </p>
<p>Again, thanks for posting&#8230;you got me headed in the right direction.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: semprealbero</title>
		<link>http://thinkvitamin.com/code/ruby-arrays/#comment-12022</link>
		<dc:creator>semprealbero</dc:creator>
		<pubDate>Fri, 24 Jul 2009 19:29:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkvitamin.com/features/ruby/ruby-arrays#comment-12022</guid>
		<description>Am a newbie with Ruby. I&#039;ve been through so many references and yours is helping me learn array in simplest terms.  Thank you so much.</description>
		<content:encoded><![CDATA[<p>Am a newbie with Ruby. I&#8217;ve been through so many references and yours is helping me learn array in simplest terms.  Thank you so much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: johnchristopher</title>
		<link>http://thinkvitamin.com/code/ruby-arrays/#comment-11800</link>
		<dc:creator>johnchristopher</dc:creator>
		<pubDate>Tue, 21 Jul 2009 21:51:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkvitamin.com/features/ruby/ruby-arrays#comment-11800</guid>
		<description>Something like that ?
y = 3
y.times do &#124;x&#124;
puts &quot;#{my_vitamins[x]} is tasty!&quot;
end</description>
		<content:encoded><![CDATA[<p>Something like that ?<br />
y = 3<br />
y.times do |x|<br />
puts &#8220;#{my_vitamins[x]} is tasty!&#8221;<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jason</title>
		<link>http://thinkvitamin.com/code/ruby-arrays/#comment-11526</link>
		<dc:creator>jason</dc:creator>
		<pubDate>Fri, 17 Jul 2009 07:06:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkvitamin.com/features/ruby/ruby-arrays#comment-11526</guid>
		<description>How do I use the form of -

my_vitamins.each do &#124;vitamin&#124;
  puts &quot;#{vitamin} is tasty!&quot;
end

to print just the first x elements from the array ?
(i.e instead of &quot;each&quot;, I only want the first x elements)

Thanks.

Jason</description>
		<content:encoded><![CDATA[<p>How do I use the form of -</p>
<p>my_vitamins.each do |vitamin|<br />
  puts &#8220;#{vitamin} is tasty!&#8221;<br />
end</p>
<p>to print just the first x elements from the array ?<br />
(i.e instead of &#8220;each&#8221;, I only want the first x elements)</p>
<p>Thanks.</p>
<p>Jason</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PHP Developer</title>
		<link>http://thinkvitamin.com/code/ruby-arrays/#comment-6717</link>
		<dc:creator>PHP Developer</dc:creator>
		<pubDate>Fri, 22 May 2009 13:52:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkvitamin.com/features/ruby/ruby-arrays#comment-6717</guid>
		<description>Thank you for posting nice article on Ruby Array it&#039;s very use full for me.</description>
		<content:encoded><![CDATA[<p>Thank you for posting nice article on Ruby Array it&#039;s very use full for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Auto Blogs</title>
		<link>http://thinkvitamin.com/code/ruby-arrays/#comment-6716</link>
		<dc:creator>Auto Blogs</dc:creator>
		<pubDate>Sun, 26 Apr 2009 22:22:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkvitamin.com/features/ruby/ruby-arrays#comment-6716</guid>
		<description>I&#039;ve got a great start now.. :)  Ruby used to scare me. lol</description>
		<content:encoded><![CDATA[<p>I&#39;ve got a great start now.. :)  Ruby used to scare me. lol</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Auto Blogs</title>
		<link>http://thinkvitamin.com/code/ruby-arrays/#comment-28186</link>
		<dc:creator>Auto Blogs</dc:creator>
		<pubDate>Sun, 26 Apr 2009 22:22:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkvitamin.com/features/ruby/ruby-arrays#comment-28186</guid>
		<description>I&#039;ve got a great start now.. :)  Ruby used to scare me. lol</description>
		<content:encoded><![CDATA[<p>I&#039;ve got a great start now.. :)  Ruby used to scare me. lol</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gabriellestates</title>
		<link>http://thinkvitamin.com/code/ruby-arrays/#comment-6715</link>
		<dc:creator>gabriellestates</dc:creator>
		<pubDate>Mon, 02 Feb 2009 04:14:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkvitamin.com/features/ruby/ruby-arrays#comment-6715</guid>
		<description>Very well done - you&#039;ve taken something very complex and broken it down so well I think I finally get it! Thanks :)&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://www.onlinepharmacycr.com&quot; rel=&quot;nofollow&quot;&gt;Pharmacy providing brand name and generic prescriptions drugs with worldwide delivery.&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Very well done &#8211; you&#39;ve taken something very complex and broken it down so well I think I finally get it! Thanks :)</p>
<p><a href="http://www.onlinepharmacycr.com" rel="nofollow">Pharmacy providing brand name and generic prescriptions drugs with worldwide delivery.</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gabriellestates</title>
		<link>http://thinkvitamin.com/code/ruby-arrays/#comment-28185</link>
		<dc:creator>gabriellestates</dc:creator>
		<pubDate>Mon, 02 Feb 2009 04:14:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkvitamin.com/features/ruby/ruby-arrays#comment-28185</guid>
		<description>Very well done - you&#039;ve taken something very complex and broken it down so well I think I finally get it! Thanks :)&lt;a href=&quot;http://www.onlinepharmacycr.com&quot; rel=&quot;nofollow&quot;&gt;Pharmacy providing brand name and generic prescriptions drugs with worldwide delivery.&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Very well done &#8211; you&#039;ve taken something very complex and broken it down so well I think I finally get it! Thanks :)<a href="http://www.onlinepharmacycr.com" rel="nofollow">Pharmacy providing brand name and generic prescriptions drugs with worldwide delivery.</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic page generated in 0.216 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-02-11 15:38:33 -->

