Cards (3)

  • What is a local variable
    A variable that is only accessible in the subroutine that its called in and only exists while the subroutine is being executed
  • What are the benefits of using local variables (3)

    • Value cannot be accidentally chnaged elsewhere in the program
    • Same variable name can be reused elsewhere in the program
    • Frees up memory as a local variable is removed from memory when the program is finished with it
  • What is a global variable
    Can be used anywhere in the program'