#What is the equivalent of || && within a Provable.if?

6 messages · Page 1 of 1 (latest)

frank aspen
#

Hey all, I have multiple Bool values I want to check and even if say one of them is true I want the Provable.if true condition to run, for example

Bool_1 = Bool(false)
Bool_2 = Bool(false)
Bool_3= Bool(true)

const finalBool = Provable.if(Bool_1 || Bool_2 || Bool_3, Bool(true), Bool(false));

I did try the above and when printing first the 3 bools I get
false false true
But printing finalBool gets me
false

Any help is appreciated, thanks a ton 😄

#

I believe I can achieve the same with Provable.switch but just wanted to know if the above is possible too in Provable.if

ivory thunder
#

You can use XOR operation to determine if exactly one condition among several is true, you can set a default operand as false and then apply the XOR operation sequentially to each condition

tough field
#
const finalBool = Provable.if(Bool_1.or(Bool_2).or(Bool_3));
floral elm
#

why not just use this?
const finalBool = Bool_1.or(Bool_2).or(Bool_3);

tough field