Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • C#
void Square(ref int x)
{
    x = x * x;
}

The ref keyword indicates that a value is passed by reference.
To use this function you gonna need to type ref before your value
double Square(int value) => System.Math.Pow(value, 2);

Math.Pow returns a double.
By default, this method will be private.
int Square(int x) => (int)Math.Pow(x, 2);
int Square(int x)
{
    return x * x;
}
function Square (X : Integer) return Integer is
begin
   return X * X;
end Square;

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