You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
305 B

  1. template CondTernary() {
  2. signal input in;
  3. signal output out;
  4. var a = 3;
  5. var b = a==3 ? 1 : 2; // b is 1
  6. var c = a!=3 ? 10 : 20; // c is 20
  7. var d = b+c; // d is 21
  8. out <-- ((in & 1) != 1) ? in + d : in; // Add 21 if in is pair
  9. }
  10. component main = CondTernary()