Binding vars inside `cond`?

That would require either the “anti-pattern” as the language creator finds it or additional glue code, which would normalise outputs of numerous functions to a common error struct for example. Possible, “but”.

I apologise for not mentioning that the example was a “dummy” code. In this particular case this would work but in reality the conditions can be various and differ from what’s in the example so it has to be “generic” approach.

Yes, I wrote:

For a more specific example: I don’t want to read through megabytes of a file in order to parse some stuff out of it unless I know it is worth doing this by first checking e. g. File.stat to make sure it is not gigabytes. If I read it before the block I might not like the outcome in case it is actually too large to handle :wink: So yes, I can rewrite the cond into some nested ifs/cases and it will work but the elegant terseness of the cond block would be gone.