4

The yul documentation states:

No “else” block can be defined.

It seems really weird. Yul has much more complex control flow schemes like loops and switches. Also other EVM languages like Solidity support the else blocks and they compile to EVM's jump opcodes just fine.

What's the reason behind this design decision?

1 Answer 1

0

ifs are used mostly for revert conditions, where the else is simply the continuation of the program. An if cond { a } else { b } pattern can be done via switch cond case 0: b default: a.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.