Control flow looks like C, but every iteration costs gas, so loops must be bounded by something the caller controls or by a constant.
for (uint256 i; i < xs.length; ++i) {
if (xs[i] == 0) continue;
total += xs[i];
}Prefer `++i` over `i++` and cache `xs.length` in a local for a small saving on hot loops.