3.1.1.13 Local variables in subroutines. Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Define the relationship between variables and subroutines.

A

Subroutines may declare their own variables, known as local variables.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Outline the rules of local variables.

A

Local variables only exist while the subroutine is executing and are only accessible within the subroutine.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why is it good practice to use local variables?

A
  • You can give local variables the same name in different functions because they are only recognised by the function they are declared in.

Local variables are deleted as soon as any function is over and release the memory space which it occupies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly