{ } と do end の違い - gan2 の Ruby 勉強日記 require 'benchmark' puts Benchmark::CAPTION puts Benchmark.measure { a = [1, 2, 3] a.replace [4, 5, 6] } このように { } を使うのは OK なのに { } を do end に変えると require 'benchmark' puts Benchmark::CAPTION puts Benchmark.measure do a = [1, 2, 3] a.replace [4, 5, 6] end `measure': no block given (LocalJumpError) ってエラーが出る。 そう、ふたつのブロック構文{}とdo〜endの優先順位の違い。 「puts Benchmark.measure