Wednesday, May 21, 2008

Typical Ruby File

Take a look of my small Ruby file:

#!/usr/bin/ruby

#it is a comment

=begin
mutliple line comments
=end

puts "Hello World"


Notes:
- Single line comment, put "#" in the front
- Multiple line comments (use =begin...=end block) :
=begin
...comments..
=end

Ruby Hands-on

It is fun to use Interative Ruby command line console to test out ruby code.

Let's do a hello world.

In your Unix/Linux or Mac OS X console,

type in
shell>irb
irb(main):001:0>


Let's do a Hello World
irb(main):001:0> puts "Hello World"
Hello World
=> nil