るりまサーチ

最速Rubyリファレンスマニュアル検索!
24件ヒット [1-24件を表示] (0.111秒)
トップページ > クエリ:t[x] > クエリ:ruby[x] > 種類:モジュール関数[x] > クエリ:puts[x] > モジュール:Kernel[x] > クエリ:block_given?[x]

別のキーワード

  1. _builtin puts
  2. csv puts
  3. stringio puts
  4. kernel puts
  5. zlib puts

ライブラリ

検索結果

Kernel.#block_given? -> bool (18145.0)

メソッドにブロックが与えられていれば真を返します。

...返します。

iterator? は (ブロックが必ずイテレートするとはいえないので)推奨されていないの
block_given? を使ってください。

//emlist[例][ruby]{
def check
if block_given?
puts
"Block is given."
else
puts
"Block isn't given."
end
end...
...check{} #=> Block is given.
check #=> Block isn't given.
//}...

Kernel.#iterator? -> bool (6145.0)

メソッドにブロックが与えられていれば真を返します。

...返します。

iterator? は (ブロックが必ずイテレートするとはいえないので)推奨されていないの
block_given? を使ってください。

//emlist[例][ruby]{
def check
if block_given?
puts
"Block is given."
else
puts
"Block isn't given."
end
end...
...check{} #=> Block is given.
check #=> Block isn't given.
//}...