Catch form problem

Started by iNPRwANG, June 14, 2012, 02:23:09 AM

Previous topic - Next topic

iNPRwANG

The newLisp document said:
Quote
In the second syntax, catch evaluates the expression exp, stores the result in symbol, and returns true. If an error occurs during evaluation, catch returns nil and stores the error message in symbol. This form can be useful when errors are expected as a normal potential outcome of a function and are dealt with during program execution.


And in my code, I'd throwed a exception in catch of second syntax, why it always get "true" result instead of nil?



(setq result nil)

(println (catch (dotimes (x 100)
  (if (= x 50) (throw "fin"))) 'result))

iNPRwANG

#1
Please close this subject, I known what's my mistake :)

Patrick

#2
Would you mind posting the solution just for the record in case somebody else finds this topic while looking for it?