ClearMyBench
Welcome, Guest
Please Login or Register.    Lost Password?
Re:Ruby basics (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:Ruby basics
#4379
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
We can pass parameters to method new and those parameters can be used to initialize class variables.

When we plan to declare the new method with parameters, we need to declare the method initialize at the time of the class creation
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4380
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
The initialize method is a special type of method, which will be executed when the new method of the class is called with parameters.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4381
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
In the initialize method, we can pass on the values of the local variables to the instance variables .

The local variables hold the values that are passed along with the new method.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4382
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
In Ruby, functions are called methods. Each method in a class starts with the keyword def followed by the method name.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4383
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
The method name always preferred in lowercase letters.

We end a method in Ruby by using the keyword end.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4384
ShriNi (User)
Software Techie (PEGA) currently on a Career Break
Platinum Boarder
Posts: 4000
graph
User Offline Click here to see the profile of this user
Gender: Female Location: Secundrabad India Birthdate: 1983-09-29
Re:Ruby basics 3 Years, 10 Months ago Karma: 0  
Variables are the memory locations which holds any data to be used by any program.

There are five types of variables supported by Ruby
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
get the latest posts directly to your desktop
logo footer   Copyright 2009 - 2013 HotRecruiter.Com - All Rights Reserved