BMGT 302 Lecture Notes - Lecture 12: Local Variable

50 views3 pages

Document Summary

Scope of variables: scope: which parts of a program have access to which other parts (variables and subroutines?, procedure-level variable (i. e. local variable): End sub: module-level variable (i. e. private variable) Or private salary as currency: project-level variable (i. e. public variable) Scope of subroutines: the default is that all subs have public scope: Or public sub test() end sub: to be callable only by subs within its module. Modularizing programs: one long sub (that does it all) is a bad habit. There are too many lines with possible bugs. It is difficult to reuse the code from long subs in other programs: becomes a sequence of relatively short subs, each with a specific task to perform. Their brevity and focus make them easier to read. Can be tested independently so bugs are easier to detect and fix. A much greater chance can be reused in other programs.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers