Create a method, greeter , that
takes no arguments and yields to a block.
Create a Proc, phrase , that
puts "Hello there!" . Pass this
to greeter instead of a block.
(Don’t forget to pass &phrase
instead of just phrase!)
Till now I have this :
def greeter
yield
end
phrase = Proc.new do
puts "Hello there!"
end
But I do not see where and how I must use the &phrase ?
Can someone help me figure out how to solve this ?
1. Create a method, greeter, that takes no arguments and yields to a
block.
2. Create a Proc, phrase, that puts "Hello there!". Pass this to
greeter instead of a block. (Don't forget to pass &phrase instead of
just phrase!)
Till now I have this :
def greeter
yield
end
phrase = Proc.new do
puts "Hello there!"
end
But I do not see where and how I must use the &phrase ?
Can someone help me figure out how to solve this ?
Roelof
--
Juanjo Conti
Mi primer novela ya se puede conseguir en:
It's all in the description of task 2. You pass something to a method but...
Kind regards
robert
···
On Wed, Nov 19, 2014 at 1:16 PM, Roelof Wobben <r.wobben@home.nl> wrote:
Hello,
Im trying to do this exercise :
1. Create a method, greeter, that takes no arguments and yields to a block.
2. Create a Proc, phrase, that puts "Hello there!". Pass this to greeter
instead of a block. (Don't forget to pass &phrase instead of just phrase!)
Till now I have this :
def greeter
yield
end
phrase = Proc.new do
puts "Hello there!"
end
But I do not see where and how I must use the &phrase ?
Can someone help me figure out how to solve this ?
Create a method, greeter , that takes
no arguments and yield s to
a block.
Create a Proc, phrase, that puts "Hello there!". Pass this to greeter
instead of a block. (Don’t forget to pass &phrase
instead of just phrase!)
Till now I have this :
def greeter
yield
end
phrase = Proc.new do
puts "Hello there!"
end
But I do not see where and how I must use the
&phrase ?
Can someone help me figure out how to solve this ?
Roelof
–
Juanjo Conti
Mi primer novela ya se puede conseguir en: [http://www.juanjoconti.com.ar/xolopes](http://www.juanjoconti.com.ar/xolopes)
1. Create a method, greeter, that takes no arguments and yields to a
block.
2. Create a Proc, phrase, that puts "Hello there!". Pass this to
greeter instead of a block. (Don't forget to pass &phrase instead of
just phrase!)
Till now I have this :
def greeter
yield
end
phrase = Proc.new do
puts "Hello there!"
end
But I do not see where and how I must use the &phrase ?
Can someone help me figure out how to solve this ?
Create a method, greeter ,
that takes no arguments and yield s
to a block.
Create a Proc, phrase ,
that puts "Hello there!" .
Pass this to greeter
instead of a block. (Don’t forget to
pass &phrase instead
of just phrase!)
Till now I have this :
def greeter
yield
end
phrase = Proc.new do
puts "Hello there!"
end
But I do not see where and how I must use
the &phrase ?
Can someone help me figure out how to
solve this ?
Roelof
–
Juanjo Conti
Mi primer novela ya se puede conseguir en: [http://www.juanjoconti.com.ar/xolopes](http://www.juanjoconti.com.ar/xolopes)
–
Juanjo Conti
Mi primer novela ya se puede conseguir en: [http://www.juanjoconti.com.ar/xolopes](http://www.juanjoconti.com.ar/xolopes)