Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use try catch (Exception Handling) in Netlogo

how can I use exception handling in NetLogo? If I have an error it displays run-time error. I do not want to display this error, instead I want to catch it at run-time and do something else instead (like in c# or vb.net). Any help will be appreciated. Thanks

like image 738
Mirza Bilal Avatar asked Sep 20 '25 12:09

Mirza Bilal


1 Answers

The carefully primitive does exactly that, and the error message is available using error-message:

carefully [
  print mean [] ; try to take the mean of an empty list
] [
  print error-message ; or do something else instead...
]
like image 117
Nicolas Payette Avatar answered Sep 23 '25 06:09

Nicolas Payette