template Array () {
signal input in[3];
signal input index;
signal output out;
signal a;
assert(index==3);
a <-- in[index];
out <== a;
}
component main {public [in, index]} = Array();
/* INPUT = {
"in": ["5", "3", "2"],
"index": "3"
} */
in zkrepl this compiles and out = 3, even though that index position is out of bounds of the array. when i use a <-- in[3]; instead, the compiler correctly throws an error. assigning index to higher numbers returns various other values.
can someone help me understand if i'm doing something wrong?
hi
i'm trying to figure out what's going on here:
in zkrepl this compiles and
out = 3
, even though thatindex
position is out of bounds of the array. when i usea <-- in[3];
instead, the compiler correctly throws an error. assigningindex
to higher numbers returns various other values.can someone help me understand if i'm doing something wrong?
thanks