What about
Let ret: Number
If (someCondition) {
<a lot of expensive calculations>
ret = resultOfOperations
} else {
<a lot of other different expensive operations>
ret = resultOfOtherOperations
}
return ret
You can't declare ret inside the brackets