AngelScript
Default arguments

Sometimes implementing different functions for each overload is unecessary when the difference can be provided with a default value to a parameter. This is where default arguments come in handy.

By defining default arguments in the declaration of the function, the script doesn't have to provide these values specifically when calling the function as the compiler will automatically fill in the default arguments.

  void Function(int a, int b = 1, string c = "")
  {
    // Inside the function the arguments work normally
  }
  void main()
  {
    // Default arguments doesn't have to be informed
    // The following three calls produce the exact same result
    Function(0);
    Function(0,1);
    Function(0,1,"");
  }

When defining a default argument to one of the parameters, all subsequent parameters must have a default argument too.