A field element is a value in the domain of
p is the prime number set by default to
p = 21888242871839275222246405745257275088548364400416034343698204186575808495617
As such, field elements are operated in arithmetic modulo
circom language is parametric to this number, and it can be changed without affecting the rest of the language (using
GLOBAL_FIELD_P). To understand why we need to operate over
Z/pZ and when it makes sense to change
p, take a look at the Background section.
There is no explicit boolean type. In
circom we consider:
TRUE : Any field element different from
FALSE : Only the element
Arrays can hold a finite number of elements (known at compilation time) of the same type (
var or the same type of components or arrays again).
The elements are numbered from zero on, and can be accessed using the corresponding index of their position.
Array access is made using square brackets.
Declaration of an array of a given type is made by adding
 aside of the variable identifier and including the size between the brackets (which should be defined using constant values and/or numeric parameters of templates).
m[i,j] for arrays of arrays (matrices) is not allowed. The access and the declaration should be consistent with their type and hence we access and declare with
m[i] is an array.
Below there are few examples of declarations with and without initialization:
var x = [2,8,4];var z[n+1]; // where n is a parameter of a templatevar dbl = base;var y = someFunction(n);
The following case would result in a compilation
error, since the size of the array is not explicitly given:
var z = [2, 8, 4];