Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / quick function question

Author
Message
That1Smart Guy
17
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 23rd Mar 2009 00:36
can/must a function only have one endfunction or can it have as many as is necessary(sp?)
Quirkyjim
17
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 23rd Mar 2009 00:57
Just one.

Why?

It goes like such:

Function Function_Name(parameters)
do stuff...
endfunction return_value(optional)

or

Function Function_Name(paramters)
do stuff...
if something
exitfunction return_value(optional)
endif
endfunction return_value(if it's possible to have a return value in one, it has to be in the other)

~QJ
That's what they WANT you to think...
Caleb1994
17
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 23rd Mar 2009 01:21
i don't think he knows about exitfunction



That1smartguy:

You have to have a endfunction and can only have 1

but if you need to exit a function early you can use exitfunction it does the same thing just you can have as many as you want.

but just for clarity

ENDFUNCTION is used once and MUST be used.

EXITFUNCTION is used if needed and can be used many times.

New Site! Check it out \/
That1Smart Guy
17
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 23rd Mar 2009 01:21 Edited at: 23rd Mar 2009 01:21
but do you HAVE to have an endfunction or can it be only exits?

nvm, caleb posted his same time as mine
Caleb1994
17
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 23rd Mar 2009 02:21
i was about to say, I thought i made that pretty clear! hahaha

New Site! Check it out \/

Login to post a reply

Server time is: 2026-07-21 19:06:06
Your offset time is: 2026-07-21 19:06:06