Define FOR_EACH

Define Documentation

FOR_EACH(ELEM, ELEMS)

For-each loop, iterates across an array or slice. For example:

newarray(IntArray, int);
IntArray xs = AMAKE(IntArray, 5);

int elem1 = 5;
int elem2 = 3;
push(&xs, &elem1, sizeof(int));
push(&xs, &elem2, sizeof(int));

FOR_EACH(x, xs) {
    printf("%d\n", *x);
}
Will print 5 then 3.