• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 191
  • Last Modified:

Passing multiple parms to proc/func

I’ve forgotten the syntax for sending multiple parameters to a proc/func ?

For example you could call my SaveData proc in any of these ways:

SaveData(Data1, Data2)
SaveData(Data1, Data2, Data3 ……, etc …. etc, etc…..)
SaveData(Data1, Data2, Data3 ……, etc …. etc, etc….., etc …. etc, …..)


(And I don’t mean passing an array or overloading)

Cant remember the code syntact whan creating the proc/func !!!??!?
Tried googling but its one of them days … :(

Thanks in advance,
K.
0
Kinger247
Asked:
Kinger247
  • 3
1 Solution
 
VipulKadiaCommented:
Hi Kinger247,
when you declare your sub/function, use 'Optional' keywork before parameter.
e.g. Public sub SaveData(Param1 as int, Optional Param2 as int, Optional Param3 as int)
       
0
 
Kinger247Author Commented:
but that means you have to specify all the parameters in your function.
There's a way of doing this withought knowing how many are being passed.
So you could pass 1 paramerter or 1000.
0
 
Kinger247Author Commented:
its kind of like specifing an array of parameters ...

0
 
Kinger247Author Commented:
Thats it, thankyou ..
I'm really having one of those dumb days today.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now