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.

Newcomers DBPro Corner / function help

Author
Message
gpex
19
Years of Service
User Offline
Joined: 29th May 2005
Location:
Posted: 1st Jun 2005 14:26
i\'m trying to figure out functions and i wrote this and it keeps printing out the nuber 0 instead of 11 like i want it to...

indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 1st Jun 2005 18:58
this code will work for you, notice how i used the variable names sum and myresult.

they incurr the same result but due to functions local and global properties we carry local functions sum over to myresult.




If no-one gives your an answer to a question you have asked, consider:- Is your question clear.- Did you ask nicely.- Are you showing any effort to solve the problem yourself
LordDario
21
Years of Service
User Offline
Joined: 26th Apr 2003
Location:
Posted: 4th Jun 2005 08:20 Edited at: 4th Jun 2005 08:23
gpex you made a very simple mistake. the problem is that your not storing the function result to any variable in other words this is what you should have:
cls
print "hello"
c = peace(5, 6)
print c
wait key
end

function peace(a, b)
a = a + b
endfunction a


notice the c =

to help you understand better try the following command before wait key

print peace(5,6) so as you can see you had the right concept going but you never stored anything
gpex
19
Years of Service
User Offline
Joined: 29th May 2005
Location:
Posted: 5th Jun 2005 14:57
ooo, i get it now...thank you lord.

Login to post a reply

Server time is: 2024-09-23 21:24:18
Your offset time is: 2024-09-23 21:24:18