4 ms·You can sort of do this in Groovy. def val = {try { 1 } catch(ex) { 2 }}.call() assert(1 == val)by eldenbishop 17y agoYou can sort of do this in Groovy. def val = {try { 1 } catch(ex) { 2 }}.call() assert(1 == val)