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 / User Defined Types

Author
Message
solo
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Israel
Posted: 25th Sep 2002 11:39
hi, i have 2 questions about types:

1.How do i pass a user defined type, as a parameter -
to a function?

2.I've declared a local user defined type in a function that returns it, but something is wrong with
the return value.
The first inner type's field is empty...

Is it me, or is it a bug ...

rem ***********************
type myType
a as integer
b$ as string
endtype
rem ***********************

yyy as myType
yyy=test1()

print "yyy.b$=";yyy.b$
print "yyy.a=";yyy.a

wait key
end


function test1()

rem declaring a variable of the new type:
xxx as myType

rem initiate the variable:
xxx.a=8
xxx.b$="kkk"

rem return the variable:
endfunction xxx
SoulTaker
21
Years of Service
User Offline
Joined: 26th Sep 2002
Location:
Posted: 29th Sep 2002 07:38
Why are you doing it that way?

All you have to do is this!

rem ***********************
type myType
a as integer
b$ as string
endtype
rem ***********************

yyy as myType

Rem you have already declared your Type Variable yyy above.

print "yyy.b$=";yyy.b$
print "yyy.a=";yyy.a

wait key
end


function test1()

rem initiate the variable:
yyy.a=8
yyy.b$="kkk"

endfunction
solo
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Israel
Posted: 29th Sep 2002 08:28
you're right, i'm just testing the syntax and the limits...
anyway, tnx...

Login to post a reply

Server time is: 2024-03-28 22:25:11
Your offset time is: 2024-03-28 22:25:11