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:
d as vec2
d.x = 1.0 : d.y = 2.0
e as vec2
e.x = 3.0 : e.y = 4.0
f as vec2
f = addvec2( d, e )
text 0,0, "f = < " + str$(f.x) + ", " + str$(f.y) + " >"
wait key
end
type vec2
x as float
y as float
endtype
function addvec2( a as vec2, b as vec2 )
out as vec2
out.x = a.x + b.x
out.y = a.y + b.y
endfunction out
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.