LB Booster
Programming >> Liberty BASIC language >> functions http://lbb.conforums.com/index.cgi?board=lblang&action=display&num=1472956155 functions
Post by Alincon on Sep 4th, 2016, 02:29am
I had some trouble with a function that had no parameters. (it uses global variables) It worked when I added a dummy parameter. Are functions in LBB required to have at least one parameter passed? I think subs do not require any parameters to be passed.
r.m. Re: functions
Post by Richard Russell on Sep 4th, 2016, 09:12am
I had some trouble with a function that had no parameters. (it uses global variables)
It works for me:
Code:
global MyGlobal
MyGlobal = 12345
print noparms()
end
function noparms()
noparms = MyGlobal
end function
If you want to report a problem, it would be enormously helpful if you could include a self-contained program that demonstrates it. Simply saying "I had some trouble" doesn't really cut it!
Richard. Re: functions
Post by Alincon on Sep 4th, 2016, 2:55pm
I keep forgetting to include a code sample, even though I know better. Sorry. But I see your sample shows an empty set of parens. I didn't have them in my code. That must be where I went wrong.
r.m.
Re: functions
Post by Richard Russell on Sep 4th, 2016, 4:58pm
But I see your sample shows an empty set of parens. I didn't have them in my code.
I can't see how it would distinguish a function call from a regular variable without them. A variable is allowed to have the same name as a function in LB, isn't it?