Featured
-
How Regression Testing Detects Integral Errors In Business Processes
Humans are forever changing and evolving and so to
by kristina.rigina -
Get Display Banner Advertising Opportunity on FindNerd Platform
“Do you have a product or service that nee
by manoj.rawat -
Android O Released with Top 7 New Features for App Developers
Android was founded by Andy Rubin, Rich Miner, Nic
by sudhanshu.tripathi -
Top 5 Features That Make Laravel the Best PHP Framework for Development
Laravel is a free open source Web Framework of PHP
by abhishek.tiwari.458 -
Objective C or Swift - Which Technology to Learn for iOS Development?
Swift programming language is completely based on
by siddharth.sindhi
Tags
Iterators and its usage in ruby
In Ruby, iterators are methods basically used by the collections. Collections are a set of objects. Hashes & Arrays are the example of collections. Iteration is a process by which we can get or set the elements in collections. We will discuss...
using return keyword within a Ruby block
As we all know,Ruby Blocks and Ruby Methods work in tandem and the output/value of the last line/expression being executed by the block is returned to the associated method .
Have a look at this example:
2.1.5 :006 > def demo
2.1.5 :0...
Ruby Blocks
As we all know,Ruby Blocks and Ruby Methods work in tandem as clearly elucidated by the below example:
def demo_method
yield "hello"
end
demo_method { |block_argument| "#{block_argument}!! our first ruby blog"}
here, the ...
each, collect and map in ruby
1> 'each' will loop through each element of the array and evaluate whatever is return inside the block, but it returns the original array without any change.
a = [5,10,15,20]
=> [5, 10, 15, 20]
a.each {|t| t+2}
=> [5, 10, 15, 20...