Why Yul doesn't have the else block?
Why Yul doesn't have the else block?
Loading saved threads...
CodeSandwich · External communityPost link
External question — Ethereum Stack Exchange
Author: CodeSandwich
Original post: https://ethereum.stackexchange.com/questions/91379
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
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?
Quote
Report
Leonardo Alt · External communityPost link
External answer — Ethereum Stack Exchange
Author: Leonardo Alt
Original post: https://ethereum.stackexchange.com/a/135744
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
if
s 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
.
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External answer — Ethereum Stack Exchange Author: Leonardo Alt Source score (net votes, not local likes): 0 Original post: https://ethereum.stackexchange.com/a/135744 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. if s 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 .
Checking account access…