Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Is there a possibility to call a function without giving the number of arguments?

 

for example

DIM func(LaLaLaLa) As Integer

 

and then call for example one time func(4, 7, 3, 8) and the second time

func(1, 3)?

 

Would appreciate the answer.

  • Moderators
Posted

Yes, if you overload the fuction, meaning that you need to create the let's say three functions with the same name but different signature on each, eg.

 

Private myFunc() as string
   'TODO
End Function

Private myFunc(x as integer) as string
   'TODO
End Function

Private myFunc(x as integer, y as integer) as string
   'TODO
End Function

Private myFunc(x as integer, y as integer, s as string) as string
   'TODO
End Function

Visit...Bassic Software
  • *Experts*
Posted
You can also set the function to it's maximum arguments and only utilize those necessary depending on its requirements at the time. In fact, one of the arguments could be the determinator to which calculations are used and by which variables.

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...