| Subject |
Re: how to handle missing optional arguments in a function |
| From |
Bruce Beacham <bbeacham@no_plm_lowman.co.uk> |
| Date |
Thu, 1 Oct 2020 22:46:19 +0100 |
| Newsgroups |
dbase.getting-started |
Use false as a placeholder when calling a function where you want to
provide a late-placed parameter.
Within the function, dBASE will assign false to the variables in
positions where a parameter is not provided. Parameters provided
are assigned to variables in turn. It's logical!
In PLUS, the construct , , will throw an error.
Bruce Beacham
On 01/10/2020 21:26, Gaetano wrote:
>
>
> Hi All,
>
> I have customized one webclass.cc function to add a text msg to
> the errorMessage function:
>
> Function errorMessage( oErr, cMsg, cTitleBackColor, cTitleTextColor )
>
> if you supply less than the total count of arguments, how does dBase
> know which argument is supplied and which is omitted?
>
> In other words, if I only want to supply cMsg or only a cTitleTextColor
> but no cTitleBackColor, how to I do that? Is there a standard
> placeholder for empty arguments?
>
> would something like the following work?
>
> errorMessage(,"my message",,"red")
>
> If I have to test for argument types, how do I reference the "first
> argument"?
>
> Cheers,
> Gaetano.
>
|
|