Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Php
declare(strict_types=1);
function square(int $x): int
{
    return $x * $x;
}

// square(4) -> 16
// square(3.4) -> Uncaught TypeError: Argument 1 passed to square() must be of the type int, float given
function Square (X : Integer) return Integer is
begin
   return X * X;
end Square;

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