<?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: Ruby Block Scope</title>
	<atom:link href="http://railsforphp.com/2008/02/18/ruby-block-scope/feed/" rel="self" type="application/rss+xml" />
	<link>http://railsforphp.com/2008/02/18/ruby-block-scope/</link>
	<description></description>
	<lastBuildDate>Fri, 27 Jan 2012 15:24:08 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: Ochronus</title>
		<link>http://railsforphp.com/2008/02/18/ruby-block-scope/comment-page-1/#comment-22601</link>
		<dc:creator>Ochronus</dc:creator>
		<pubDate>Thu, 05 May 2011 13:18:01 +0000</pubDate>
		<guid isPermaLink="false">http://railsforphp.com/2008/02/18/ruby-block-scope/#comment-22601</guid>
		<description>I&#039;ve written a tutorial/review on ruby blocks and closures with code examples, be sure to check it out: &lt;a href=&#039;http://blog.mostof.it/why-ruby-part-two-blocks-and-closures/&#039; rel=&quot;nofollow&quot;&gt;ruby blocks and closures&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>I&#8217;ve written a tutorial/review on ruby blocks and closures with code examples, be sure to check it out: <a href='http://blog.mostof.it/why-ruby-part-two-blocks-and-closures/' rel="nofollow">ruby blocks and closures</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://railsforphp.com/2008/02/18/ruby-block-scope/comment-page-1/#comment-21994</link>
		<dc:creator>John</dc:creator>
		<pubDate>Mon, 11 Apr 2011 11:02:08 +0000</pubDate>
		<guid isPermaLink="false">http://railsforphp.com/2008/02/18/ruby-block-scope/#comment-21994</guid>
		<description>PHP minimal version:
echo implode(&quot;,&quot;, $fruits = array(&#039;apple&#039;,&#039;banana&#039;,&#039;orange&#039;)); echo end($fruits);</description>
		<content:encoded><![CDATA[<p>PHP minimal version:<br />
echo implode(&#8220;,&#8221;, $fruits = array(&#8216;apple&#8217;,'banana&#8217;,'orange&#8217;)); echo end($fruits);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The MIM</title>
		<link>http://railsforphp.com/2008/02/18/ruby-block-scope/comment-page-1/#comment-9804</link>
		<dc:creator>The MIM</dc:creator>
		<pubDate>Wed, 16 Sep 2009 15:42:27 +0000</pubDate>
		<guid isPermaLink="false">http://railsforphp.com/2008/02/18/ruby-block-scope/#comment-9804</guid>
		<description>minimal version:
f = nil
[&#039;apple&#039;, &#039;bannana&#039;, &#039;orange&#039;].each {&#124;f&#124; print &quot;#{f}, &quot;}; puts f</description>
		<content:encoded><![CDATA[<p>minimal version:<br />
f = nil<br />
['apple', 'bannana', 'orange'].each {|f| print &#8220;#{f}, &#8220;}; puts f</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://railsforphp.com/2008/02/18/ruby-block-scope/comment-page-1/#comment-6121</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Thu, 07 May 2009 08:49:55 +0000</pubDate>
		<guid isPermaLink="false">http://railsforphp.com/2008/02/18/ruby-block-scope/#comment-6121</guid>
		<description>fruit = %w[apple banana orange]
string = fruit.join(&#039;, &#039;)
puts &quot;#{string}, #{fruit.last}&quot;</description>
		<content:encoded><![CDATA[<p>fruit = %w[apple banana orange]<br />
string = fruit.join(&#8216;, &#8216;)<br />
puts &#8220;#{string}, #{fruit.last}&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rafal Piekarski</title>
		<link>http://railsforphp.com/2008/02/18/ruby-block-scope/comment-page-1/#comment-231</link>
		<dc:creator>Rafal Piekarski</dc:creator>
		<pubDate>Thu, 17 Apr 2008 21:50:44 +0000</pubDate>
		<guid isPermaLink="false">http://railsforphp.com/2008/02/18/ruby-block-scope/#comment-231</guid>
		<description>But I&#039;ve found some other solution for this:

fruit = %w[apple banana orange]
last_fruit = nil
 
fruit.each do &#124;f&#124; 
  print &quot;#{f}, &quot; 
  last_fruit = f
end
 
print last_fruit

which would be near php method:

fruits = %w[apple banana orange]
fruit = nil
 
fruits.each do &#124;fruit&#124; 
  print &quot;#{fruit}, &quot; 
end
 
print fruit

It&#039;s nicer than method with &quot;last_fruit&quot;. But it&#039;s only a hint.</description>
		<content:encoded><![CDATA[<p>But I&#8217;ve found some other solution for this:</p>
<p>fruit = %w[apple banana orange]<br />
last_fruit = nil</p>
<p>fruit.each do |f|<br />
  print &#8220;#{f}, &#8221;<br />
  last_fruit = f<br />
end</p>
<p>print last_fruit</p>
<p>which would be near php method:</p>
<p>fruits = %w[apple banana orange]<br />
fruit = nil</p>
<p>fruits.each do |fruit|<br />
  print &#8220;#{fruit}, &#8221;<br />
end</p>
<p>print fruit</p>
<p>It&#8217;s nicer than method with &#8220;last_fruit&#8221;. But it&#8217;s only a hint.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

