carefully

carefully [ commands1 ] [ commands2 ]

Runs commands1. If a runtime error occurs inside commands1, NetLogo won't stop and alert the user that an error occurred. It will suppress the error and run commands2 instead.

The error-message reporter can be used in commands2 to find out what error was suppressed in commands1. See error-message.

carefully [ show 1 / 1 ] [ print error-message ]
=> 1
carefully [ show 1 / 0 ] [ print error-message ]
=> division by zero

Take me to the full NetLogo Dictionary