|
-
October 5th, 2001, 09:51 PM
#1
Optional Keyword
Can someone tell me what the default is for a variable that is declared as optional? For example:
Function Fun1(optional byval an_int as Integer)
Fun2(an_int)
End Function
Function Fun2(byval an_int as Integer)
' do something here with an_int
End Function
What will this pseudocode do?
I will rate all useful suggestions 
In reply to:
A man who asks a question is a fool for 15 minutes. A man who doesn't ask a question is a fool for a lifetime. -Chinese Proverb
Karok
-
October 6th, 2001, 01:12 AM
#2
Re: Optional Keyword
When you declare a optional parameter. You must set default value such as
Function Fun1(optional byval an_int as Integer=12)
If you don't
parameter value be zero.
-
October 6th, 2001, 01:13 AM
#3
Re: Optional Keyword
Hi,
The syntax for typed optional arguments allows you to specify a default value. If the argument is omitted when the procedure is called, then the argument will have the default value. Here u didnt specify the default value. The default value for the integer when declared will be 0. So it will take it as 0.
If u are declaring the variable as variant then u can use the IsMissing() function to find out whether the procedure is called with the argument or not.
Have a nice day.
sunil.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|