I am trying to use a conditional (like an if statement) in assembly. The only assembly reference site I have ever been able to find says the opcode JUMPI is the way to do this.

Using solc 0.7.0, the latest version.

I wasn't sure how to specify the destination parameter for JUMPI, so I just put the word destination in there as a placeholder to test a compilation.

    jumpi (destination, eq (b_test, 1))
    mstore (t_byte, 1)

It didn't recognize the JUMPI command.

Error: Function not found.
 165 |          jumpi (destination, eq (b_test, 1))
     |          ^^^^^

How can I implement conditional assembly code using solc 0.7.0?

Also, if anyone knows of any better assembly reference sites, I would be interested in knowing about them.


1 Answer 1


you can use if statements like this:

if eq(1, 1) { ... } // true
if eq(1, 2) { ... } // false

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.