July 2011
Intermediate to advanced
400 pages
8h 46m
English

In this chapter, you’ll be looking at many of the effects (and side effects) of passing arguments and returning values to and from methods. First, though, I’ll take a moment to summarize the types of methods you’ve used up to now.
An instance method is declared inside a class definition and is intended for use by a specific object or “instance” of the class, like this:
methods.rb
class MyClass # declare instance method def instanceMethod puts( "This is an instance method" ) end end # create object ob = MyClass.new # use instance method ob.instanceMethod ...
Read now
Unlock full access