Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Php
foreach(range(1, 10) as $i)
  echo 'Hello'. PHP_EOL;

Using range() instead of counting
for ($i = 0; $i < 10; $i++) {
    echo 'Hello' . PHP_EOL;
}

Note the necessary newline (PHP_EOL), not to print every time on the same line
with Ada.Text_IO;
use Ada.Text_IO;
for I in 1 .. 10 loop
  Put_Line ("Hello");
end loop;

New implementation...
< >
programming-idioms.org