define hello so that it contains only a yield statement, : Code Block « Method « Ruby
- Ruby
- Method
- Code Block
define hello so that it contains only a yield statement,
then call the new version of hello with a block (the code in braces).
def hello
yield
end
hello { puts "Hello, Matz!" } # => Hello, Matz!
Related examples in the same category