April 28, 2024, 01:03:12 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Using UDTs

Started by Egil, June 05, 2009, 10:51:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Egil

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?
Support Amateur Radio  -  Have a ham  for dinner!

Ionic Wind Support Team

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.
Ionic Wind Support Team

Egil

Thanks a  lot Paul! ;D ;D
Support Amateur Radio  -  Have a ham  for dinner!

Ionic Wind Support Team

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.
Ionic Wind Support Team

Egil

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....
Support Amateur Radio  -  Have a ham  for dinner!