[prev in list] [next in list] [prev in thread] [next in thread]
List: ruby-talk
Subject: Re: proc problem
From: Roelof Wobben <r.wobben () home ! nl>
Date: 2014-11-19 13:02:02
Message-ID: 546C94CA.8040109 () home ! nl
[Download RAW message or body]
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Yes. I did. That's whty I figured the
solution myself. <br>
<br>
Roelof<br>
<br>
Juanjo Conti schreef op 19-11-2014 13:55:<br>
</div>
<blockquote
cite="mid:CA+pHy4qZCnZxurpBLo94XqJK=2LEu_sZmnk-ghPDThGOYEXrzg@mail.gmail.com"
type="cite">
<div dir="ltr">Did you read the article I pointed out? If you're
learning, instead of just make the code work, you should worry
to understand why it did work.
<div><br>
</div>
<div>Greets,</div>
<div><br>
</div>
<div>PS: Sorry Robert about the direct response.</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">2014-11-19 9:48 GMT-03:00 Roelof Wobben
<span dir="ltr"><<a moz-do-not-send="true"
href="mailto:r.wobben@home.nl" \
target="_blank">r.wobben@home.nl</a>></span>:<br> <blockquote class="gmail_quote" \
style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div>Yep. I found it myself that the answer is
greeter(&phrase) <br>
<br>
Roelof<br>
<br>
<br>
Juanjo Conti schreef op 19-11-2014 13:28:<br>
</div>
<div>
<div class="h5">
<blockquote type="cite">
<div dir="ltr">greeter &phrase<br>
<div><br>
</div>
<div>I recommend you to read about blocks and
Procs. This link may be useful but there should
be better ones: <a moz-do-not-send="true"
href="http://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Method_Calls#The_ampersand_.28.26.29"
\
target="_blank">http://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Method_Calls#The_ampersand_.28.26.29</a></div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">2014-11-19 9:16 GMT-03:00
Roelof Wobben <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:r.wobben@home.nl"
target="_blank">r.wobben@home.nl</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0
0 0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"> Hello,
<br>
<br>
Im trying to do this exercise : <br>
<br>
<ol>
<li>Create a method, <code>greeter</code>,
that takes no arguments and \
<code><span>yield</span></code>s to a block.</li>
<li>Create a Proc, <code>phrase</code>,
that puts <code>"Hello there!"</code>.
Pass this to <code>greeter</code>
instead of a block. (Don't forget to
pass <code>&phrase</code> instead
of just <code>phrase</code>!)</li>
</ol>
<p>Till now I have this : <br>
</p>
<p>def greeter<br>
yield <br>
end<br>
<br>
phrase = Proc.new do <br>
puts "Hello there!"<br>
end<br>
</p>
<p>But I do not see where and how I must use
the &phrase ?<br>
Can someone help me figure out how to
solve this ?<span><font color="#888888"><br>
</font></span></p>
<span><font color="#888888">
<p>Roelof<br>
<br>
</p>
<br>
</font></span></div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div>
<div dir="ltr">Juanjo Conti<br>
Mi primer novela ya se puede conseguir en: <a
moz-do-not-send="true"
href="http://www.juanjoconti.com.ar/xolopes"
\
target="_blank">http://www.juanjoconti.com.ar/xolopes</a></div> </div>
</div>
</blockquote>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="gmail_signature">
<div dir="ltr">Juanjo Conti<br>
Mi primer novela ya se puede conseguir en: <a
moz-do-not-send="true"
href="http://www.juanjoconti.com.ar/xolopes"
target="_blank">http://www.juanjoconti.com.ar/xolopes</a></div>
</div>
</div>
</blockquote>
<br>
</body>
</html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic