How can I avoid the console output when assigning a value to a variable in Ruby

Viewed 1874

Is it possible to escape that effect when assigning to a value:

irb(main):584:0>a = true
=>true
irb(main):584:0>

I have a code that has lots of assignings and when I am trying to test it I can not see the result because of all these returned values:

true
false
true
false
true
true
..
3 Answers

None of the answers above could work for my setup so I ended up just making a little helper and declared things out of scope. Quick and dirty, but gets the job done:

def quiet(&block)
  yield
  nil
end

foo = nil
quiet { foo = 'long' * 1000 }
Related