How to pass Optional argument for User Define Function

Is it possible to create a user define function with optional argument in AFL?

function Test (Var1,Var2,Var3,Var4,Var5)
 {
 if(IsNull(Var5))
 {
 Var5 = 0;
 }
 xyz = Var1+Var2+Var3;
 return xyz;
 }
 
 Test(1,2,3,4,5);  //Default and using
 
 //Can this be Done ?
 
  Test(1,2,3,4);
   Test(1,2,3);

If yes then can you show me any example ?

function test(num_list) {
	mx = MxFromString("{{"+num_list+"}}");
	return MxSum(mx);
}

printf("%g\n", test("1,2,3,4,5") );
printf("%g\n", test("1,2,3,4") );
printf("%g\n", test("1,2,3") );
6 Likes

@fxshrat provided workaround, but generally optional arguments are supported only for internal functions and user-definable functions exposed by plugins (DLLs).

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.