in reply to Re: IF condition with a rangein thread IF condition with a range
You could also use
if (abs($y-$x) <= 1) [download]
(Added to earlier post)