<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>NotRocketSurgery: Syntactical Sugar: conditionals</title>
    <link>http://notrocketsurgery.com/articles/2007/03/05/syntactic-sugar-conditionals</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Relax.</description>
    <item>
      <title>Syntactical Sugar: conditionals</title>
      <description>&lt;p&gt;This article &lt;a href="http://rubyjudo.com/2007/3/5/syntactical-sugar-conditionals"&gt;has moved&lt;/a&gt; over to our sister spin-off blog, &lt;a href="http://rubyjudo.com"&gt;RubyJudo&lt;/a&gt;, which focuses on more arcane technical topics than NotRocketSurgery.&lt;/p&gt;</description>
      <pubDate>Mon, 05 Mar 2007 14:19:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:e169550b-10a6-464d-a7ae-ba24991a84f0</guid>
      <author>jd</author>
      <link>http://notrocketsurgery.com/articles/2007/03/05/syntactic-sugar-conditionals</link>
      <category>ruby</category>
      <category>syntacticalsugar</category>
    </item>
    <item>
      <title>"Syntactical Sugar: conditionals" by JD</title>
      <description>&lt;p&gt;Yes, if the condition is complicated, then a 3+ line block make sense. For multi-line conditionals, I bring back use of the &lt;code&gt;then&lt;/code&gt; keyword for readability as well:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;if @foo.bar? &amp;amp;&amp;amp; @foo.foo? &amp;amp;&amp;amp; @foo.moo? ||
   (@foo.new_record? &amp;amp;&amp;amp; @foo.name == 'bar')
then
  @foo.horrible_example = true
end&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;To some degree, Ruby helps keep your code simple. I think this is because you have more direct tools to accomplish what you need to do, like blocks and methods like &lt;code&gt;#collect&lt;/code&gt; and &lt;code&gt;#inject&lt;/code&gt;. However, keeping your code comprehendible often takes conscious effort&amp;#8212;in other words, I&amp;#8217;ve still seen some pretty badly written Rails code.&lt;/p&gt;</description>
      <pubDate>Tue, 06 Mar 2007 13:52:45 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:47ef332a-6940-4034-8cec-c6991a3fc3e9</guid>
      <link>http://notrocketsurgery.com/articles/2007/03/05/syntactic-sugar-conditionals#comment-155</link>
    </item>
    <item>
      <title>"Syntactical Sugar: conditionals" by kit</title>
      <description>&lt;p&gt;Yes I would say I use that last syntax quite a bit.  If the expressions are simple, it ends up looking better.  If you have multiple branches (else if) or if the expressions are complicated in any way, it could get ugly.&lt;/p&gt;


	&lt;p&gt;Speaking of which, does ruby code end up in smaller, more manageable chunks, from smaller methods to less complex expressions, all on its own, or is it just me?&lt;/p&gt;</description>
      <pubDate>Tue, 06 Mar 2007 02:21:16 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:e1154710-63fa-42f4-a3cd-32ddeb81d522</guid>
      <link>http://notrocketsurgery.com/articles/2007/03/05/syntactic-sugar-conditionals#comment-154</link>
    </item>
  </channel>
</rss>
