Hello,
Sometimes we see on code that there's something like,
def initialize
···
---------------------
end
is written. What does it do? Also, what is class method and instance method? What is class variable & method variable?
I'm a noob. so, please will anyone answer?
--
Junayeed Ahnaf Nirjhor
//
I will answer your question, but please read up on ruby before asking these
questions. They are fairly elementary if you take the time to understand
the language.
the Initialize method is the constructor.
class methods are called like this: ClassName.method_name
you can write them like this:
def self.method_name
end
instance methods are methods on instances of a class
a class variable is a variable that is the same throughout the class (the
syntax is @@class_variable)
method variables... They could mean the parameters you pass in, or local
variables you create in a method.
···
On Sat, Dec 17, 2011 at 10:03 AM, Junayeed Ahnaf Nirjhor < zombiegenerator@aol.com> wrote:
Hello,
Sometimes we see on code that there's something like,
def initialize
---------------------
end
is written. What does it do? Also, what is class method and instance
method? What is class variable & method variable?
I'm a noob. so, please will anyone answer?
--
Junayeed Ahnaf Nirjhor
//
--
Sincerely,
Isaac Sanders
hi Junayeed,
there are lots of good tutorials available online, including but
certainly not limited to:
http://pine.fm/LearnToProgram/
http://mislav.uniqpath.com/poignant-guide/
hth,
- j
···
--
Posted via http://www.ruby-forum.com/.
thanks for the explanation
···
On 12/17/2011 09:33 PM, Isaac Sanders wrote:
I will answer your question, but please read up on ruby before asking these
questions. They are fairly elementary if you take the time to understand
the language.
the Initialize method is the constructor.
class methods are called like this: ClassName.method_name
you can write them like this:
def self.method_name
end
instance methods are methods on instances of a class
a class variable is a variable that is the same throughout the class (the
syntax is @@class_variable)
method variables... They could mean the parameters you pass in, or local
variables you create in a method.
On Sat, Dec 17, 2011 at 10:03 AM, Junayeed Ahnaf Nirjhor< > zombiegenerator@aol.com> wrote:
Hello,
Sometimes we see on code that there's something like,
def initialize
---------------------
end
is written. What does it do? Also, what is class method and instance
method? What is class variable& method variable?
I'm a noob. so, please will anyone answer?
--
Junayeed Ahnaf Nirjhor
//
--
Junayeed Ahnaf Nirjhor
//r