CISC 101 Lecture Notes - Lecture 22: Local Variable, Global Variable

60 views2 pages

Document Summary

Variable scope is the block of code in which you can access it (x) local variable if deined inside a piece of code. Local scope! (x) global variable if deined outside of code. Fun2() >> 5 then error because b wasn"t deined. 8 calling a funcion wouldn"t mater because it looks at the local variable. The period of ime that a variable exists is called its lifeime. Local variables are automaically created when a funcion is called and destroyed when the funcion terminates. Thus the values of local variables are not retained from one funcion call to the next. What if you need a variable that is visible and will survive. A global variable is a variable that is deined outside of any funcion deiniion. A global variable is available to any funcion. Syntax error is a problem with how you wrote a line a code, before it runs.

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

Related Documents