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 / custom type function issue

Author
Message
Four Dimensional
18
Years of Service
User Offline
Joined: 11th Jun 2008
Location: lost in thought
Posted: 12th Aug 2010 11:53
To clarify, I attempted to build a function that uses user-defined types as input and outputs that same type. The type is vectors: only 2-element (x,y) so far; and the function is meant to add two vectors and return the resulting vector. I encounter an error I assume will happen when anyone else attempts to compile the following code which states "both user defined type values must use the same type". Granted, I have recently revisited DBPro, so my knowledge of the basics is a bit rusty.

Here's the Code:



Ideally, it would output "f = < 4.0, 6.0 >". Any help is greatly appreciated.

Imagine this: there may exist infinite parallel universes, all similar to ours, but we may never be able to encounter or even interact with them.
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 12th Aug 2010 12:01
you can't return UDTs from functions


Is't life, I ask, is't even prudence, to bore thyself and bore thy students?
Four Dimensional
18
Years of Service
User Offline
Joined: 11th Jun 2008
Location: lost in thought
Posted: 12th Aug 2010 12:07
That is depressing...

Well, thank you for the answer. That's the last thing I might have suspected.

Imagine this: there may exist infinite parallel universes, all similar to ours, but we may never be able to encounter or even interact with them.
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 12th Aug 2010 12:16
Yeah... Generally I have a global UDT variable "ret" that I use for returning anything.


Is't life, I ask, is't even prudence, to bore thyself and bore thy students?

Login to post a reply

Server time is: 2026-07-25 07:02:21
Your offset time is: 2026-07-25 07:02:21