Ruby

Ruby is a dynamically typed object oriented programming language with both imperative and functional features. Ruby code is often interpreted but several systems perform native code generation too.

Example Code

Here is an example of the 100 doors problem:

#!/usr/bin/env ruby

def doors n
	# Initialize an array
	doors = [false] * n

	# Process the doors
	(1..n).each do |inc|
		(inc..n).step(inc) do |d|
			doors[d] = !doors[d]
		end
	end

	# Print out the results
	doors.each_with_index do |b, i|
	    puts "Door \##{i} is #{b ? 'open' : 'closed'}."
	end
end

# Call the doors function with n = 100
doors(100)

Why would I learn this language?

Ruby is a both powerful and easy to learn. It has a syntax which feels natural and is also very flexible.

Ruby is surrounded by a passionate community and there are a wide range of 3rd party libraries available. This makes it easy to develop new applications by relying on existing work.

Ruby is a cross platform development language with multiple implementations, including MRI (the default implementation), JRuby, IronRuby and Rubinius.

Starting Points

Try Ruby
An online interactive tutorial.
Learn to Program
A complete introduction for programming using Ruby including advice for students and teachers.
The Poignant Guide to Ruby
A fun illustrated introduction to programming using Ruby
Getting started with Ruby
A summarized list of resources for learning about programming and Ruby
Programming Ruby: The Pragmatic Programmer's Guide
A tutorial and reference for the Ruby programming language.

Further Reading