Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
M3

M3

Ratings: (0)|Views: 30 |Likes:
Published by lovestone69679

More info:

Categories:Topics, Art & Design
Published by: lovestone69679 on Apr 21, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less

04/21/2010

pdf

text

original

 
GLOBAL AND LOCAL VARIABLES
Global Variables
 Global variables are approached by any function that is part of the main program. They are put intoplay by combining memory locations with the names of the variable. Unlike local variables, globalvariables do not come back into play each time the function has been called back. Global variablesare used when you need the value outside of the scope that it was originally created in.
Local Variables
 Local variables are only existent within the exact function that creates them. They are otherwiseunknown to the other functions and the main program. Local variables stop once the function whichcreated them has been ended. They do however come back into play each time the function has beenexecuted. A local variable only exists for its scope. Local variables are usually only needed in onesection of code and are only modified within that section.
Global and variables declared in my programs
 Global and local variables that were included in my UCAS calculator included the following:DimPassUnitPoints As Integer DimMeritUnitPoints As Integer DimDistinctionUnitPoints As Integer The above are examples of local variables that have been declared inside of a subsided module.They are only used within that specific module.Global and local variables that were included within my notesaver included the following:Dimsaverfile1 As NewSaveFileDialogue saverfile1.DefaultExt ="*.doc"The above are examples of local variables in my notesaver, known as procedural variables. Thereason for this is that it is not limited to a certain section of the program, instead it can be usedanywhere in the program
Scope of Variables
The scope looks at the visibility of a variable, where it is in the program, can it be seen and used. Anexample could be that in my note saver program:
Dimsaverfile1 As NewSaveFileDialogue saverfile1.DefaultExt ="*.doc´,The above variable is declared inside of the event handler and can only be used inside of that eventhandler; it does not exist outside of it. This is a local variable. A variable that is declared within the form class can initially be used within the event handlers, it willhave a wider scope.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->