# Global and local precedence

If a local variable is declared that has the same name as a global variable, then it will take precedence over the global variable. The program that follows declares a global named value, however, the function myFunction declares a local variable named value and gives it a floating point value. This variable has priority over the global.

    global value as integer = 1

    do
    	print ( value )
    	myFunction ( )

    	sync ( )
    loop

    function myFunction ( )
    	value as float = 1.2
    	print ( value )
    endfunction

When you run the program you will see 1 and 1.2 displayed on screen. Due to the local variable taking precedence within the function any attempt to work with value inside myFunction affects the local and not the global.