<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>uRaNGaTaNG &#187; return</title>
	<atom:link href="http://www.rngtng.com/tag/return/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rngtng.com</link>
	<description>Featuring Ruby, Rails, Web development, Arduino, Processing, Nabaztag and more...</description>
	<lastBuildDate>Thu, 12 Jan 2012 10:08:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://www.rngtng.com/?pushpress=hub'/>
		<item>
		<title>Beautify your views using &#8220;return&#8221;</title>
		<link>http://www.rngtng.com/2008/06/06/beautify-your-views-with-using-return/</link>
		<comments>http://www.rngtng.com/2008/06/06/beautify-your-views-with-using-return/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 09:59:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ruby, Rails & Co.]]></category>
		<category><![CDATA[beauty of code]]></category>
		<category><![CDATA[hint]]></category>
		<category><![CDATA[return]]></category>
		<category><![CDATA[view]]></category>

		<guid isPermaLink="false">http://urangatang.wordpress.com/?p=6</guid>
		<description><![CDATA[A nice way to keep your views clean and not to spoil them with condition clauses, is to use the 'return' statement like you would do in a method:

Take this very simple exmaple:

ugly:


nice:


UPDATE:
There's one pitfall, I forgot to mention: Every outout BEFORE the return statement will be discarded, so this part: 


Will result in ...]]></description>
			<content:encoded><![CDATA[<p>A nice way to keep your views clean and not to spoil them with condition clauses, is to use the &#8216;return&#8217; statement like you would do in a method:</p>
<p>Take this very simple exmaple:</p>
<p>ugly:</p>
<pre class="brush: ruby; title: ; notranslate">
unless @place
  &lt;%= @place.name %&gt;
end
</pre>
<p>nice:</p>
<pre class="brush: ruby; title: ; notranslate">
return if @place.nil?
&lt;%= @place.name %&gt;
</pre>
<p><strong>UPDATE:</strong><br />
There&#8217;s one pitfall, I forgot to mention: Every outout BEFORE the return statement will be discarded, so this part: </p>
<pre class="brush: ruby; title: ; notranslate">
&lt;%= &quot;Always display this sentence&quot; %&gt;
return if @place.nil?
&lt;%= @place.name %&gt;
</pre>
<p>Will result in an empty output as well. This is quite a pitty and I&#8217;m not sure if it&#8217;s a bug or feature. A may raise it soon..</p>
<p class="wp-flattr-button"></p>]]></content:encoded>
			<wfw:commentRss>http://www.rngtng.com/2008/06/06/beautify-your-views-with-using-return/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

