Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Ada
for Item of Items loop
   Do_Something (Item);
end loop;
for (size_t i = 0; i < sizeof(items) / sizeof(items[0]); i++) {
	DoSomethingWith(&items[i]);
}

sizeof the array divided by the size of the first element computes the number of elements, often defined as macro ARRAY_SIZE

New implementation...