Functions and procedures create new spaces within our code. Variables created within a function or procedure are called local variables. They live within the function or procedure, can only be accessed by the function or procedure’s code, and are removed from memory when the function or procedure ends.
Examples
The following code has local variables within each function. Each local variable lives within the function it is created inside, can only be accessed by that functions code, and is removed from memory when the function ends.
You may notice that both read_string and read_integer have variables called result - these are different variables. Remember that each function or procedure is isolated from the others, so the things they create only exist within their scope.