Global variables are variables that are defined outside functions, closures, class or structures. They are accessible in all parts of code. The local variables are defined within functions, closures, class or structure. They are accessible only within the type in which they are defined. Both global and local variables are stored variables.