Difference between .next and .succ in Ruby

What's the difference between Fixnum

methods .next

and .succ

in Ruby? This seems to work the same way:

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

      

If there is any difference, why are there two methods that do the same?

+5


source to share


1 answer


They are equivalent. Fixnum#succ

is just synonymous Fixnum#next

.



They even share the same block in the reference guide .

+9


source







All Articles