Sign up or Sign in | Share
 
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
#4499
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, 11 Months ago Karma: 0  
The collect method need not always be associated with a block.


The collect method returns the entire collection, regardless of whether it is an array or a hash.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4500
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, 11 Months ago Karma: 0  
The collect method is not the right way to do copying between arrays.

There is another method called a clone which should be used to copy one array into another array.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4501
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, 11 Months ago Karma: 0  
We normally use the collect method when you want to do something with each of the values to get the new array.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4502
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, 11 Months ago Karma: 0  
Ruby provides a whole set of I/O-related methods implemented in the Kernel module.

All the I/O methods are derived from the class IO.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4503
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, 11 Months ago Karma: 0  
The class IO provides all the basic methods, such as read, write, gets, puts, readline, getc, and printf.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#4504
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, 11 Months ago Karma: 0  
The puts Statement:

We have assigned values to variables and then printed the output using puts statement.

The puts statement instructs the program to display the value stored in the variable.

This will add a new line at the end of each line it writes.
 
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