newLISP Fan Club

Forum => newLISP in the real world => Topic started by: iNPRwANG on June 14, 2012, 02:23:09 AM

Title: Catch form problem
Post by: iNPRwANG on June 14, 2012, 02:23:09 AM
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))
Title: Re: Catch form problem
Post by: iNPRwANG on June 14, 2012, 02:24:48 AM
Please close this subject, I known what's my mistake :)
Title: Re: Catch form problem
Post by: Patrick on June 14, 2012, 05:12:37 AM
Would you mind posting the solution just for the record in case somebody else finds this topic while looking for it?