|
|
|
|
|
|
|
Chapter 2: Working with Subroutines
This chapter introduces subroutines, named blocks of code that can be called from other VBScript code. There are two basic types of subroutines, procedures and functions. Some of VBScript's numerous built-in functions are also introduced. Defining and calling procedures This first example introduces a simple procedure, which is executed when it is called from other VBScript code. Page 14. JavaScript version Using parameters An example that uses parameters to pass values into a procedure. Page 15. JavaScript version Using functions This example uses a function that takes two strings and concatenates them. Page 16. JavaScript version MsgBox built-in function Here we take a look at one of VBScript's most common built-in functions, the MsgBox ("Message Box"). Page 19. JavaScript version VBScript function reference When I wrote VBScript: A Visual Quickstart Guide, I intended to provide a VBScript function reference on this Web site. But Microsoft has enhanced the VBScript language so often that this concept, while noble, had to be abandoned. Fear not, however: Microsoft has an incredible VBScript reference online and it includes far more than just functions. You can find it on Microsoft's Scripting Web site. Date and Time functions VBScript includes numerous date and time functions that make easy work of the passage of time. Page 20. JavaScript version Creating random messages Built-in math functions such as Rnd and Int make it easy to generate random messages in VBScript. Page 21. JavaScript version Formatting text with String functions VBScript includes numerous string functions that allow you to format text in various ways. Page 22. JavaScript version |
|
|
| All content © 1997-1999 Paul Thurrott |