Explain how yield works and how it differs from calling a block via &block.call.

Last updated 27 June 2026

  • yield calls the implicit block without allocating a Proc, so it is faster, but the block cannot be stored or forwarded.

  • A &block parameter converts the block into a named Proc you can call (block.call), store, or forward (other(&block)).

  • Use yield by default and &block only when you must capture or pass the block on.

  • https://www.turing.com/interview-questions/ruby
  • https://www.youtube.com/watch?v=lkunzd5uDrw
  • https://blog.jacobvosmaer.nl/0004-ruby-scheduler-interaction/
  • https://wohotech.in/coding/top-java-interview-questions
  • https://jetthoughts.com/blog/ruby-3-4-yjit-performance-guide/
  • https://speed.ruby-lang.org/
  • https://flexiple.com/python/interview-questions
  • https://www.reddit.com/r/rails/comments/1shfrbq/3_years_rails_dev_but_failed_basic_interview/
All Ruby interview questions