Ruby 3.1 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Integerクラス > %
self % other -> Numeric
modulo(other) -> Numeric
算術演算子。剰余を計算します。
13 % 4 # => 1 13 % -4 # => -3 -13 % 4 # => 3 -13 % -4 # => -1