GLBasic forum

Main forum => GLBasic - en => Topic started by: backspace on 2012-Dec-28

Title: Type as a parameter to a function?
Post by: backspace on 2012-Dec-28
Is it possible to pass a "type" variable as a parameter to a function?
Title: Re: Type as a parameter to a function?
Post by: hardyx on 2012-Dec-28
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
Title: Re: Type as a parameter to a function?
Post by: backspace on 2012-Dec-28
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.
Title: Re: Type as a parameter to a function?
Post by: matchy on 2012-Dec-30
Quote from: backspace on 2012-Dec-28
Noobs have to start somewhere...

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