Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Integer#next

next

Alias of #succ

Returns the successor integer of self (equivalent to self + 1):

Example
1.succ  #=> 2
-1.succ #=> 0

Integer#next is an alias for Integer#succ.

Related: Integer#pred (predecessor value).

See also #succ #modulo #nobits? #magnitude also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0