IonicWind Software

IWBasic => General Questions => Topic started by: Egil on June 05, 2009, 10:51:43 AM

Title: Using UDTs
Post by: Egil on June 05, 2009, 10:51:43 AM
Trying to learn how to use UDTs correctly, I found this thread: http://www.ionicwind.com/forums/index.php/topic,3214.0.html
Can I define my own types in a similar way as Larry's example to pass multiple variables back to the calling routine?
Title: Re: Using UDTs
Post by: Ionic Wind Support Team on June 05, 2009, 11:09:17 AM
If you are asking if you can return a UDT from a subroutine, then yes.

TYPE blah
int a
int b
ENDTYPE

def yy as blah
yy = mysub()

...

SUB mysub(), blah
  def xx as blah
  xx.a = 1
  xx.b = 2
  return xx
ENDSUB

Paul.
Title: Re: Using UDTs
Post by: Egil on June 05, 2009, 11:18:01 AM
Thanks a  lot Paul! ;D ;D
Title: Re: Using UDTs
Post by: Ionic Wind Support Team on June 05, 2009, 01:37:35 PM
You're welcome.  It is one of those cool features that a lot of other compilers don't support without having to allocate memory and pass pointers around.
Title: Re: Using UDTs
Post by: Egil on June 06, 2009, 12:52:14 AM
That was the method I tried whithout success when I noticed that an easier method really did exist. But I couldn't figure out how to do it. As usual I was doing things much to complicated....