The variable difference in the subroutine shown in Figure 1 is local to that subroutine.
SUBROUTINE checkSpeed(currentSpeed, speedLimit)
difference ← currentSpeed - speedLimit
IF difference > 0 THEN
RETURN true
ELSE
RETURN false
ENDIF
ENDSUBROUTINE
Figure 1
State two properties that only apply to local variables.
131 exam-style questions on AQA GCSE Computer Science Structured programming and subroutines (procedures and functions). Each one has a worked solution and a mark scheme showing where the marks go.