<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.compsci.ca/skins/common/feed.css?270"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.compsci.ca/index.php?action=history&amp;feed=atom&amp;title=Hello%2C_Ruby%21</id>
		<title>Hello, Ruby! - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.compsci.ca/index.php?action=history&amp;feed=atom&amp;title=Hello%2C_Ruby%21"/>
		<link rel="alternate" type="text/html" href="http://wiki.compsci.ca/index.php?title=Hello,_Ruby!&amp;action=history"/>
		<updated>2026-04-14T05:43:51Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.16.0</generator>

	<entry>
		<id>http://wiki.compsci.ca/index.php?title=Hello,_Ruby!&amp;diff=3485&amp;oldid=prev</id>
		<title>Wtd at 02:48, 11 October 2008</title>
		<link rel="alternate" type="text/html" href="http://wiki.compsci.ca/index.php?title=Hello,_Ruby!&amp;diff=3485&amp;oldid=prev"/>
				<updated>2008-10-11T02:48:24Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Everything in [[Ruby]] is an object. ==&lt;br /&gt;
&lt;br /&gt;
No, really.&lt;br /&gt;
&lt;br /&gt;
You may have used [[Java]], and thought you were doing [[object-oriented]] programming, but [[Java]] is only partially [[object-oriented]].  There are still primitive values like int, float, double and such which aren't.&lt;br /&gt;
&lt;br /&gt;
This is probably the best thing about [[Ruby]], and it's one that warrants being mentioned upfront.  That said, if you have little to no [[object-oriented]] programming experience, [[Ruby]] is still friendly.&lt;br /&gt;
&lt;br /&gt;
== Hello, [[Ruby]]! ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;puts &amp;quot;Hello, Ruby!&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pretty simple.  The puts method prints an object, followed by a newline, much like [[Java]]'s System.out.println.  [[Ruby]]'s puts method is smarter, though.  It will only add a newline if one isn't already included.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;puts &amp;quot;Hello, Ruby!\n&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Would produce exactly the same output as the previous code example.&lt;br /&gt;
&lt;br /&gt;
Additional methods exist as well:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# this is a comment, by the way...&lt;br /&gt;
&lt;br /&gt;
# print doesn't append any extra newlines&lt;br /&gt;
print &amp;quot;Hello, Ruby!\n&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# printf works like the function of the same name in C&lt;br /&gt;
printf &amp;quot;%s, %s!\n&amp;quot;, &amp;quot;Hello&amp;quot;, &amp;quot;Ruby&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Friendly Ruby ==&lt;br /&gt;
&lt;br /&gt;
Now, we can output a string.  We next need a name from the user so [[Ruby]] can be friendly.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;puts &amp;quot;Hello, Ruby!&amp;quot;&lt;br /&gt;
print &amp;quot;I'm &amp;quot;&lt;br /&gt;
name = gets&lt;br /&gt;
puts &amp;quot;Ruby says, \&amp;quot;hello, #{name}\&amp;quot;&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first and second lines look familiar.  The third line calls the gets method which reads a string from standard input and assigns it to the variable &amp;quot;name&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The fourth line is probably the most novel so far.  In the string, #{name} indicates that the variable name should be inserted into the string.  This construct is incredibly flexible, and this is only a trivial demonstration of what it can do.&lt;/div&gt;</summary>
		<author><name>Wtd</name></author>	</entry>

	</feed>