pglinx:
The obvious things I see are:
- Missing semicolon on distance() call
- Not assigning return value of distance() to a variable
- Using two constants in if() condition
- Using a numeric comparison operator in if() condition rather than string comparison operator (lt)
HTH,
...
roboticus