NEWTON
Asked
5 months ago
11
views
0
Is there an equivalent of return (true) in cairo on Starknet?
ㅤ This question was originally posted on Triality
0
Just to add to the existing valid answer:
StarkWare also provides a library for this: starkware.cairo.common.bool
. You can import it with from starkware.cairo.common.bool import TRUE, FALSE
and then use TRUE
and FALSE
in your code. In reality, the library simple maps true to 1 and false to 0 (https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/cairo/common/bool.cairo)
ㅤ This answer was originally posted on Triality
answered
6 months ago
0
There is no boolean type in Cairo but you can return a felt
with value 1. For example:
func test() -> (success: felt):
return (1)
end
ㅤ This answer was originally posted on Triality
answered
6 months ago
Is there an example of migration scripts somewhere [Cairo/StarkNet]?
How do I connect my DAPP to Starknet testnet using starknetjs?
How can I create an array and populate it in the hint Cairo lang/Protostar?
ApeWorX: Why am I getting the error message "ArgumentsLengthError"?
a pointer with a hint, without doing a memory allocation
Creating Elements via a function
How to use get_fp_and_pc in Cairo Lang?