LB Booster
« functions »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:21am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: functions  (Read 374 times)
Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx functions
« Thread started 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.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: functions
« Reply #1 on: Sep 4th, 2016, 09:12am »

on Sep 4th, 2016, 02:29am, Alincon wrote:
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.
User IP Logged

Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx Re: functions
« Reply #2 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.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: functions
« Reply #3 on: Sep 4th, 2016, 4:58pm »

on Sep 4th, 2016, 2:55pm, Alincon wrote:
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?

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls