Local and Global Variables
Variables
exist only within the blocks in which
they are defined. A block is a collection of
statements enclosed by special statements such as loops and function
calls. For example, if you define a variable within a particular
function call, it will not exist when the function call returns. At
times, it is necessary to define variables that should exist
globally; in such cases you should use global_var
to define them:
global_var myglobalvariable;
Variables are local by default. You can also use
local_var
to state this explicitly.
Get Network Security Tools now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.