NEWTON

NEWTON


Popular tags

    Cairo Error: Getting Expected expression of type 'felt', got '__main__.getCurrNumber.Return'

    Asked

    5 months ago

    10

    views


    0

    In writing my Cairo program I have the following code:

    currNumber is a storage variable:

    @storage_var

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

    end

    And we have code that calls this value and uses the currNum in a subsequent function:

    ...

    let currNum = currNumber.read()

    let (res) = findSumDigits(currNum, 0)

    ...

    

    And I am getting the following error:

    Expected expression of type 'felt', got 'main.getCurrNumber.Return'.

    let (res) = findSumDigits(currNum, 0)

    ^*****^

    This question was originally posted on Triality

      cairostarknet

    1 answers

    0

    You need to make sure you take the return values from functions as tuples, otherwise you will get that error.

    Just change your code to

    ...

    let (currNum) = currNumber.read()

    let (res) = findSumDigits(currNum, 0)

    ...

    and that will solve your issue

    This answer was originally posted on Triality

    answered

    5 months ago

    Your answer

    NEWTON

    NEWTON