Quiz Stuff

Quiz 11; November 28; 4'; 1 + 2 points plus 1 point EC

  1. Write some Ruby code that uses a block to print the values in an Array a, one per line.
  2. Write a Ruby class Half that works as follows:
    >> h1 = Half.new 7
    
    >> h1.value
    => 3.5
    
    >> Half.new(1).value * 2
    => 1.0
    

EC (1pt): Write a question involving Ruby iterators or blocks and answer it.