The succ
method in Ruby is used to return the successor integer of the integer that calls this method.
intVal.succ
This method does not take any parameters.
The value returned is the successor integer of the integer value intVal
.
# create integer valuesint1 = 5int2 = 100int3 = 0int4 = -1# get successorsputs int1.succ # 6puts int2.succ # 101puts int3.succ # 1puts int4.succ # 0
succ
method. Then, the results are printed to the console.