assert 10.distance(15) == 5
assert 'Z'.distance('A') == 25
# The distance between self and d.
#
# assert 10.distance(15) == 5
# assert 'Z'.distance('A') == 25
fun distance(d: OTHER): Int
do
var cursor: OTHER
var stop: OTHER
if self < d then
cursor = self
stop = d
else if self > d then
cursor = d
stop = self
else
return 0
end
var nb = 0
while cursor < stop do
cursor = cursor.successor(1)
nb += 1
end
return nb
end
lib/core/kernel.nit:385,2--409,4