Let me summarize:
You have to 1) define variables, 2) if the variable is defined, it cannot be used in outer scope. Not only it is impossible, but it makes no sense. Such variables are stored on the call stack and simply don't exist between calls, its memory is re-used after the frame stack is removed.
You can declare variable on outer scope, but this practice is very questionable. First, you should better encapsulate related data in classes, create class instance and pass them be reference where they need to be used.
And, as to the education, training, knowledge… Everyone needs to read this, first of all:
Peter Norvig, Teach Yourself Programming in Ten Years,
http://norvig.com/21-days.html[
^].
Very encouraging, isn't it? :-)
Which you the best of luck.
—SA