SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 715 | Next

David A. Karp

"Windows Vista Annoyances: Tips, Secrets, and Hacks"


The second structure defines the RunProgram subroutine, also called from the
script two times. RunProgram simply runs the program filename passed to it;
since it??™s a subroutine and not a function, there is no return value. In theory,
you could use functions exclusively, and simply ignore the return values
of those functions that don??™t use them; the benefit of subroutines,
though, is that you don??™t have to think about handling a return value at all.
In FileExists and RunProgram, Filename is a variable (shown in
parentheses) in which passed data is placed so it can be used
inside the subroutine or function. It??™s considered a local variable,
i.e., it has no value outside of the subroutine or function.
The most important consequence of this design??”the separation of the code
into subroutines and functions??”is that it makes it easy to reuse portions of
code. Experienced programmers will intentionally separate code into useful
subroutines that can be copied and pasted to other scripts. Just think of programming
as building something out of Lego?„? blocks; the smaller the
blocks, the more versatile they become.
It??™s worth mentioning that, in the case of subroutines, the Call statement is
not strictly necessary. For example, the line:
Call RunProgram("notepad c:\temp.txt", False)
is equivalent to:
RunProgram "notepad c:\temp.txt", False
Note that without the Call keyword, the parentheses around the arguments are
omitted.


Pages:
703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6