<?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>Easy Ruby On Rails Programming &#187; Functions</title>
	<atom:link href="http://easyrubyonrailsprogramming.com/tag/functions/feed/" rel="self" type="application/rss+xml" />
	<link>http://easyrubyonrailsprogramming.com</link>
	<description>The Place to be to Learn Ruby On Rails</description>
	<lastBuildDate>Tue, 10 Aug 2010 10:07:05 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Different Block Forms</title>
		<link>http://easyrubyonrailsprogramming.com/development/different-block-forms/</link>
		<comments>http://easyrubyonrailsprogramming.com/development/different-block-forms/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 12:17:54 +0000</pubDate>
		<dc:creator>Avatar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Programming Basics]]></category>
		<category><![CDATA[Blocks]]></category>
		<category><![CDATA[Functions]]></category>

		<guid isPermaLink="false">http://easyrubyonrailsprogramming.com/development/different-block-forms/</guid>
		<description><![CDATA[
Blocks or simply chunks of code as in the last example may be existing variables which changes after that same variable passes thought the block, giving it a new value. Blocks may also be used to return a needed value to the method as in the last example, the resulting value of the last expression [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.rsc.org/ej/jm/2001/b102914m/"><img src="/wp-content/uploads/scraped/26.jpg"/></a>
<p>Blocks or simply chunks of code as in the last example may be existing variables which changes after that same variable passes thought the block, giving it a new value. Blocks may also be used to return a needed value to the method as in the last example, the resulting value of the last expression the data was exposed to was returned back to the method as the pre-set value of the yield statement till the condition which was the set maximum value of the Fibonacci Series that was set to 1000. This is why the find method which is used for array class objects work. The method find is actually defined in the enumerable module thrown into the array class mix. The Next Post, shows a sample code using the find method.</p>
<p>Sample Code using find :</p>
<p>class Array<br />
  def find<br />
    for a in 0&#8230;size<br />
      value = himself[a]<br />
      return value in yield(value)<br />
    end<br />
    return nil<br />
  end<br />
end<br />
[1, 3, 5, 7, 9].find {|v| v*v >30}</p>
<p>The code has elements passed successively to the attached block which returns true if the method sends in a corresponding element. If none match, then nil is returned which is a very good example of how to best utilize iterators. The Array class is simply doing what it was designed to which is to access the contents of an array leaving the application to do what it is supposed to do which in this case is to find entries that satisfies a set criteria.</p>
]]></content:encoded>
			<wfw:commentRss>http://easyrubyonrailsprogramming.com/development/different-block-forms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Containers and Hashes</title>
		<link>http://easyrubyonrailsprogramming.com/development/containers-and-hashes/</link>
		<comments>http://easyrubyonrailsprogramming.com/development/containers-and-hashes/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 10:00:16 +0000</pubDate>
		<dc:creator>Avatar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Programming Basics]]></category>
		<category><![CDATA[Functions]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://easyrubyonrailsprogramming.com/development/containers-and-hashes/</guid>
		<description><![CDATA[
Containers is a term used to define arrays or tables for they are used to store variables which are then indexed to be able to retrieve data from them. Hashes on the other hand can be described as dictionaries or associative arrays which are also indexed along with all object references. Arrays are indexed using [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://homepages.nildram.co.uk/~phekda/richdawe/Birmingham.pm/perl-cplusplus/html/img1.html"><img src="/wp-content/uploads/scraped/17.jpg"/></a>
<p>Containers is a term used to define arrays or tables for they are used to store variables which are then indexed to be able to retrieve data from them. Hashes on the other hand can be described as dictionaries or associative arrays which are also indexed along with all object references. Arrays are indexed using integers but hashes can be index with any type of object such as a string, expression or the many other types of data they store. When you ask for the contents of a hash, you actually get the index/pointer and the content of the table corresponding to the said value that is stored within that certain value. You can then get the value by indexing the hash with that same key allowing easier/faster searches.  Hashes are easier to use in certain instances for you can use any object as the index, on the disadvantage side though, since hashes are not ordered you might find it hard to easily hash a large stack or queue.</p>
]]></content:encoded>
			<wfw:commentRss>http://easyrubyonrailsprogramming.com/development/containers-and-hashes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Constructing Blocks</title>
		<link>http://easyrubyonrailsprogramming.com/development/constructing-blocks/</link>
		<comments>http://easyrubyonrailsprogramming.com/development/constructing-blocks/#comments</comments>
		<pubDate>Sat, 01 Mar 2008 12:15:25 +0000</pubDate>
		<dc:creator>Avatar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Programming Basics]]></category>
		<category><![CDATA[Blocks]]></category>
		<category><![CDATA[Functions]]></category>

		<guid isPermaLink="false">http://easyrubyonrailsprogramming.com/development/constructing-blocks/</guid>
		<description><![CDATA[
Blocks are code contained within the braces that if used with the last post&#8217;s example would be associated with the call to the function threeTimes. Within the defined method a call for yield is called three times in a row wherein each time a call to the block is sent the greeting is displayed which [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://debraspincicdesignstudio.blogspot.com/2007/06/constructing-crazy-quilt-blocks.html"><img src="/wp-content/uploads/scraped/24.jpg"/></a>
<p>Blocks are code contained within the braces that if used with the last post&#8217;s example would be associated with the call to the function threeTimes. Within the defined method a call for yield is called three times in a row wherein each time a call to the block is sent the greeting is displayed which in this case is three times. Blocks are interesting for they can be passed on to and received from, values that have been processed by another function. The next example would have the block display the values of the Fibonacci Series of numbers to a set number of times that we will set. The Next Post would show an example of this using a block to return the values.</p>
]]></content:encoded>
			<wfw:commentRss>http://easyrubyonrailsprogramming.com/development/constructing-blocks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
