How to correctly return from a function?

New to FreeBASIC? Post your questions here.
Post Reply
zmymhlej
Posts: 11
Joined: Mar 23, 2022 16:50

How to correctly return from a function?

Post by zmymhlej »

I came from C and I used return so far. I saw code on the forum simply wrote function = . Which way is more correct in FreeBASIC? If there is any differences, please let me know too. Thanks.
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: How to correctly return from a function?

Post by fxm »

See the 'Returning values' paragraph in the FUNCTION documentation page.
zmymhlej
Posts: 11
Joined: Mar 23, 2022 16:50

Re: How to correctly return from a function?

Post by zmymhlej »

Well, since they are equivalent I will stick with return :)
jevans4949
Posts: 1186
Joined: May 08, 2006 21:58
Location: Crewe, England

Re: How to correctly return from a function?

Post by jevans4949 »

"Function=" has the advantage that you can set in to different values at various points while evaluating the input. It saves setting a variable and including it in the return statment.
Post Reply