Library tutorials & articles
Using Optional Parameters in VBScript
- Introduction
- The work-around
Introduction
One of the nicest features of VisualBasic that is not supported in VBScript is the use of optional arguments to a subroutine or function. In fact, optional arguments are pretty standard in most high-level programming languages... so why aren't they available in VBScript? I can't answer the why, but I can propose a workaround.
If you're a regular 4Guys visitor like myself, you're likely aware that there are already a number of articles that discuss how to simulate optional arguments in VBScript. In the article Optional Arguments in VBScript, author Francis Chau looks at two common methods to simulate optional arguments: an array based approach and a NULL value approach. In the array based approach, rather than having N arguments passed into a subroutine, the developer passes one argument - namely an array containing the values for the specified parameters. In the NULL value approach, specified values are passed into the subroutine while NULL values are passed in for the non-specified values.
Related articles
Related discussion
-
Classic ASP : Page expires
by HelpTechIT (1 replies)
-
Web Development Business Partners
by xstyle36 (3 replies)
-
ASP - PHP - JSP ... which is better?
by daryljamesod (3 replies)
-
how to select multiple files at a time using Ctrl+select and upload the attachments in C# .Net 1.0?
by Ravi5308 (1 replies)
-
Error message when running vbscript on SQL Server
by smiths37 (0 replies)
Related podcasts
-
ASP.NET Caching and Performance
Steve Smith, owner of ASP Alliance and Lake Quincy Media joins us today to teach us about some hidden gems in ASP.NET caching and performance. Steve’s expertise in this area comes from first-hand experience as Lake Quincy’s ad system serves over 60 requests per second and handles over 150 million...
This thread is for discussions of Using Optional Parameters in VBScript.