Overloading and Optional Parameters

No the compiler cant sort out if you mean

  • Integer, String, Optional Variant
  • Integer, String, String, Optional Variant

the params (integer string variant) could match the first OR the second since a variant auto converts to a string and then the last param in the second is skipped

its ambiguous which you meant

@JuliaTruchsess

So you can call a shared method on a class without having an instance? And that method uses New to make an instance?

Yes

The correct signature for the method the OP asked about is exactly as posted

Public Function AddNumbers(ParamArray nums As Integer) As Integer
  
  ' nums is treated as an array
  Var i, total As Integer
  For Each i In nums
    total = total + I
  Next
  Return Total
  
End Function

In a small console app you can then write


Print Str(AddNumbers(1,2))

print str(AddNumbers(1,2,3,4,5,6,7))

The reason it doesnt autocomplete has everything to do with autocomplete NOT correctly realizing it should treat nukes as an array

Anyone relying on autocomplete to show correct code will be mislead