Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Pascal
var
  _x: Array of integer;
  _s, i: Integer;
begin
  _s := 0;
  //assume _x contains some values
  for i := Low(_x) to High(_x) do _s := _s + _x[i];
end;
for E of x loop
   S := S + E;
end loop;

x is an array.
S is initialized to be 0.

New implementation...
< >
deleplace