このマニュアルは既にメンテナンスが終了したバージョンの Ruby を対象としています。 最新版のマニュアルへ

Ruby 3.0 リファレンスマニュアル

instance method Integer#divmod

divmod(other) -> [Integer, Numeric]Ruby 2.4.0 から[permalink][rdoc][edit]

selfother で割った商 q と余り r を、[q, r] という 2 要素の配列にして返します。商 q は常に整数ですが、余り r は整数であるとは限りません。

[PARAM] other:
self に対する除数

[SEE_ALSO] Numeric#divmod