最終更新:2019-06-10 (月) 02:42:12 (1783d)
Ruby/ブロックパラメータ
https://docs.ruby-lang.org/ja/latest/doc/spec=2fcall.html#block
method(arg1, arg2, ...) do [`|' 式 ... `|'] 式 ... end method(arg1, arg2, ...) `{' [`|' 式 ... `|'] 式 ... `}'
- ||で囲んだ範囲に書く。
3.times do |i| puts "Hello Ruby!" + i.to_s end
ブロック付きメソッド
- Ruby/yield?