Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between .next and .succ in Ruby

Tags:

ruby

What is the difference between Fixnum methods .next and .succ in Ruby? It seems it works identically:

 1.next
 => 2
 1.succ
 => 2

If there is any difference why there is two method which do the same?

like image 728
Kefas Avatar asked Jul 07 '15 07:07

Kefas


1 Answers

They are equivalent. Fixnum#succ is just an synonym for Fixnum#next.

They even share the same block in the reference manual.

like image 113
Yu Hao Avatar answered Oct 20 '22 22:10

Yu Hao