Sha256: a640ee1db2219ca73097664402b4aa9ad4e14398134180cfa9dec02fd4f9621a
Contents?: true
Size: 505 Bytes
Versions: 7
Compression:
Stored size: 505 Bytes
Contents
<html> <head> <link href="/style" media="screen" rel="Stylesheet" type="text/css" /> </head> <body> <h1>Capcode hello !</h1> <p> Code : <pre>:::ruby # In an object instance variable (denoted with '@'), remember a block. def remember(&a_block) @block = a_block end # Invoke the above method, giving it a block which takes a name. remember {|name| puts "Hello, #{name}!"} # When the time is right (for the object) -- call the closure! @block.call("Jon") # => "Hello, Jon!"</pre> </p> </body> </html>
Version data entries
7 entries across 7 versions & 2 rubygems