Type as a parameter to a function?

Previous topic - Next topic

backspace

Is it possible to pass a "type" variable as a parameter to a function?
I came, I saw, I coded.

hardyx

#1
Example for pass a person type to a function:

Code (glbasic) Select
TYPE TPerson
   name$
   age%
ENDTYPE

FUNCTION IsAdult: per AS TPerson
    RETURN per.age >= 18
ENDFUNCTION

backspace

#2
I was not familiar with the "AS" keyword. Now I know. lol
Noobs have to start somewhere, and they will "try it themself" when they have learned how !!!
Thank you.
I came, I saw, I coded.

matchy

Quote from: backspace on 2012-Dec-28
Noobs have to start somewhere...

No need to devalue yourself but you are asking the right questions.