Chapter 6 - Block return values
Exercise 1: Using a block return value in a method
Below is a method named bar_chart
. We’re going to use “string multiplication” ("$" * 3
returns "$$$"
, for example) to make a primitive bar chart, using the return values from a block. Fill in the missing line of code in the middle of the each
block to yield value
to a block, and “multiply” the string "$"
by the block return value. Then print the result.