NEWTON
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
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
Cairo Error: Getting Expected expression of type 'felt', got '(res : felt)'
Cairo 0.10.0 Error: Cannot unpack return value error
How to use Hints in Cairo Lang?
storage for array
A switch statement in Cairo lang to set two distinct values
Cairo Error: Unexpected token Token('LPAR', '('). Expected: identifier.
How to use get_fp_and_pc in Cairo Lang?
What resources (Github repos, projects) do you follow about Cairo Language? Why?
Would anyone have a link or know how fast blocks would be generated on StarkNet after Regenesis ?
how I could read a felt* from ap in Cairo lang?
Any idea what this could be caused by?
How do I see my Pathfinder logs?
Cairo OR operator
How can I interact with my contract on Starknet using starknetjs?