FUNCTION with GLOBAL parameter
Jump to navigation
Jump to search
Description
If a function receives a parameter into a global variable, parameter will not be passed to a function. Instead, in function global value will be available.
Example code to demonstrate the bug.
global num num = 3 print "square=";square(4) wait function square(num) print num square=num^2 end function
Prints
"3" "square=9"
Expected behavior
"4" "square=16"
Quote from CarlGundel Oct 21st
2003 Liberty BASIC v4.04 Testing and Bug Reports => Globals as function parameters
You should be able to write that code, and it should print 16. When a parameter variable name is the same as a global name, it should be treated as a variable named scoped for that function.
Example code to work around the bug.
'code to work around the bug goes here