-
怎么断言一个值等于 0 或者 1 |
Beta Was this translation helpful? Give feedback.
Answered by
lispking
Nov 27, 2024
Replies: 3 comments 3 replies
-
很优雅的实现判断是否是0 https://github.com/iden3/circomlib/blob/master/circuits%2Fcomparators.circom#L24 |
Beta Was this translation helpful? Give feedback.
3 replies
-
如果只有 0 或者 1 这 2 种可能性,建议直接用 Bool 类型 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Bool.or(vaule.equals(Field(0)), vaule.equals(Field(1))).assertTrue('Invaild value'); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
missop
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bool.or(vaule.equals(Field(0)), vaule.equals(Field(1))).assertTrue('Invaild value');