NEWTON
Asked
5 months ago
6
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 '(res : felt)'.
let (res) = findSumDigits(currNum, 0)
^*****^
ㅤ This question was originally posted on Triality
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
6 months ago
Cairo Error: Getting Expected expression of type 'felt', got '__main__.getCurrNumber.Return'
How to use Hints in Cairo Lang?
Cairo 0.10.0 Error: Cannot unpack return value error
A switch statement in Cairo lang to set two distinct values
storage for array
Cairo Error: Unexpected token Token('LPAR', '('). Expected: identifier.
How to use get_fp_and_pc in Cairo Lang?
How to fix `bud_ptr`
Which is this extension that shows you errors before compilation ser?
Is it possible to transpile contracts that use openzeppelin libraries?
Are there situations in which we prefer declaring variables as `local` vs `tempvar`?
Does cross-chain bridge produce its own block? Or it only verify the blocks from A/B chain?
StarknetErrorCode.DEPRECATED_TRANSACTION while deploying StarkNet contract
Fixed Point pow operation error