#how to do `defer try SomeFn();`?

1 messages · Page 1 of 1 (latest)

wooden magnet
#

Is there a way to use defer to call functions that might return an error?
Along the lines of:

const PopStyle = try PushStyle(ctx);
defer try PopStyle();
azure prairie
#

no, defer statements aren't allowed to modify the return value which a try might

#

you'll have to handle the error some other way or call the function somewhere else