NEWTON
Asked
4 months ago
8
views
0
Can someone explain what "Error: ... Cannot unpack x ..." means?
ㅤ This question was originally posted on Triality
0
Just to add to what Mikey is saying here. The reason why you do let (z) = add1(y)
is that all functions return in the form of a tuple so (arg1, arg2, etc...) so if you want to get the value from a function return you have to use tuple notation (z), however with a regular operation saying let (z) = y + 1
, y + 1 isn't a tuple so you can't set it equal to a tuple.
ㅤ This answer was originally posted on Triality
answered
4 months ago
0
One case where I have seen this issue is when I am doing some computation and accidentally leave my let statement looking like a let statement for a function return. See the following example.
Say in this case y is a felt = to 10 let z = y + 1
then this is fine. Also if you are calling a function to add one to y like
let (z) = add1(y)
that is fine as you need to unpack the return value. But if you use let (z) = y + 1
then you will get that error as you cannot unpack y + 1.
ㅤ This answer was originally posted on Triality
answered
4 months ago
Equivalent to Solidity's keccak256(abi.encodePacked())?
output_ptr Assertion Error in Main - Cairo-lang
Can I transpile any solidity version?
Changing a variable with an initialized value recursively with if statements
What is Kakarot, the zkEVM written in Cairo?
How to deploy a contract through starknet.py?
Infinite Recursion Error on Cairo Compile