NEWTON

NEWTON


Popular tags

    How to write "and" conditional logic in Cairo?

    Asked

    5 months ago

    5

    views


    0

    How do you write the pseudocode:

    if x == 1 and y == 1, then return 1.

    Else return 0.

    This question was originally posted on Triality

      cairocairo-lang

    1 answers

    0

    You can also do nested and statements like this as well

    

    func main{output_ptr : felt*}():

    let (res) = andFunc()

    serialize_word(res)

    return ()

    end

    

    

    

    func andFunc() -> (res : felt):

    let x = 1

    let y = 1

    if x == 1:

    if y == 1:

    return (1)

    end

    end

    return (0)

    end

    This answer was originally posted on Triality

    answered

    5 months ago

    Your answer

    NEWTON

    NEWTON