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 Professional Discussion / Functions and their return values

Author
Message
FieldDoc
23
Years of Service
User Offline
Joined: 30th May 2003
Location: London, UK
Posted: 7th Jun 2003 20:54
Can a function return more than one value? If so, what's the syntax?
Life is like a penis:
When it's soft you can't beat it, when it's hard you get screwed.
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 7th Jun 2003 21:02
I don't think so. Definately not using the return parameter value and it seems that whilst you can pass a value from a field out of a function, you cannot pass the whole type out.

The only way I can think of doing it is via memory.

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 7th Jun 2003 21:21
globalised variables are one option, memblocks another.

Pneumatic Dryll
FieldDoc
23
Years of Service
User Offline
Joined: 30th May 2003
Location: London, UK
Posted: 7th Jun 2003 21:26
Any chance of explaining them PD?

Life is like a penis:
When it's soft you can't beat it, when it's hard you get screwed.
Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 8th Jun 2003 00:46
@FieldDoc

Global variables can be modified and their values retrieved anywhere in the code

You have to define them first:

global variablename

Optionally you can set the type

global variablename as type

Memblocks are a sequence of bytes (one byte 0..255) cannot be passed in or out of functions, but you can store data in them.

For example, if I wanted to put 4 numbers out of a function (here I am only using one byte per number, but you can use more if you want larger numbers, WRITE MEMBLOCK DWORD will give you up to 4 billion!)




OK... I think that's enough DBP work for now...

Do you want Windows menus in your DBP apps? - Get my plugin: http://snow.prohosting.com/~clone99/downloads/tpc_menus_102.zip

Login to post a reply

Server time is: 2026-07-11 22:24:20
Your offset time is: 2026-07-11 22:24:20