<?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/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>Man With Code &#187; numbers</title>
	<atom:link href="http://manwithcode.com/tag/numbers/feed/" rel="self" type="application/rss+xml" />
	<link>http://manwithcode.com</link>
	<description>Teaching You, One Tutorial at a Time</description>
	<lastBuildDate>Wed, 11 Aug 2010 02:52:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Programming With Ruby Episode 5, Numbers</title>
		<link>http://manwithcode.com/93/programming-with-ruby-episode-5-numbers/</link>
		<comments>http://manwithcode.com/93/programming-with-ruby-episode-5-numbers/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 07:42:41 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Ruby Programming]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[numbers]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://manwithcode.com/?p=93</guid>
		<description><![CDATA[Covered in This Episode Numbers Expressions Types of Numbers Constants (New type of variable!) Doing something a number of times Transcript Hello Everyone and Welcome to Programming With Ruby Episode 5, Numbers. Its sitll presented by me, Tyler. And brought to you by manwithcode.com In this episode I will be talking about numbers in Ruby. [...]]]></description>
			<content:encoded><![CDATA[<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/qdTM9mp0EsQ&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/qdTM9mp0EsQ&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object><br />
<strong>Covered in This Episode</strong></p>
<ul>
<li>Numbers</li>
<li>Expressions</li>
<li>Types of Numbers</li>
<li>Constants (New type of variable!)</li>
<li>Doing something a number of times</li>
</ul>
<p><strong>Transcript</strong></p>
<p>Hello Everyone and Welcome to Programming With Ruby Episode 5,<br />
Numbers. Its sitll presented by me, Tyler. And brought to you by<br />
manwithcode.com</p>
<p>In this episode I will be talking about numbers in Ruby. I will go<br />
over expressions, the different types of numbers, I will introduce a<br />
new variable type called a constant, and will show you how to repeat<br />
an action a certain number of times in Ruby.</p>
<p>Lets get started!</p>
<p>Pop open you Command prompt or Terminal and start Interactive Ruby. If<br />
you have forgotten, just enter &#8216;irb&#8217;.</p>
<p>First item is expressions.</p>
<pre class="brush: ruby;">
2 + 2 #=&gt; 4
2 - 2 #=&gt; 0
3 * 3 #=&gt; 9
6 / 3 #=&gt; 2
2 ** 5 #=&gt; 5
</pre>
<p>expressions with variables work in the same way</p>
<pre class="brush: ruby;">
x = 5
5 * x #=&gt; 25
x ** 4 #=&gt; 625
</pre>
<p>If you want to do math on a variable and set the value of the variable<br />
to the result use:</p>
<pre class="brush: ruby;">
x = 5
x *= 2 #=&gt; x = 10
x -= 4 #=&gt; x = 6
x /= 6 #=&gt; x = 1
</pre>
<p>In Ruby there are 3 different types of numbers. Fixnum, which are<br />
32-bit numbers. Floats, which are numbers with a value after the<br />
decimal point. Bignums which are numbers larger than 32-bits.</p>
<pre class="brush: ruby;">
5.class #=&gt; Fixnum
0.421.class #=&gt; Float
999999999999 #=&gt; Bignum
</pre>
<p>In Ruby it is possible to separate up larger numbers to improve<br />
readability in the code. Simply place in underscores</p>
<pre class="brush: ruby;">
1_000_000 #=&gt; 1000000
</pre>
<p>Lets say you are writing some code and you need to do something a<br />
certain number of times. Use this code:</p>
<pre class="brush: ruby;">
2.times do |x|
puts x
end
#=&gt; 0
#=&gt; 1
</pre>
<p>That wraps it up for this episode. If you have any questions or<br />
comments, leave a comment in the comment box below. Or email me at<br />
tyler@manwithcode.com</p>
<p>Don&#8217;t forget to donate. The button is to the right of this video.</p>
<p>Thanks for watching. Goodbye</p>
]]></content:encoded>
			<wfw:commentRss>http://manwithcode.com/93/programming-with-ruby-episode-5-numbers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<series:name><![CDATA[Ruby Programming]]></series:name>
	</item>
	</channel>
</rss>
