Qbasicnews.com

Full Version: define argument types in subs
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
TBBQ, your code will work, but you need to DECLARE SUB mysub( foo() AS ANY, i%)
Code:
TYPE mytype
   ab  as integer
   cd   as string * 10
END TYPE

SUB mysub(foo() as mytype, n%)
   for i% =  1 to n%
      print foo(i%).ab
      print foo(i%).cd
   next
END SUB

DIM myarr(1 to 20) as mytype

FOR m% = 1 to 20
   myarr(m%).ab = m% + 5
   myarr(m%).cd = CHR$(m% + 5)
NEXT

mysub myarr(), 20

Oracle this exact code will works =). I tried it out just now =P.
I didn't say it wouldn't. I just said that you or the compiler would add the line I wrote above Wink
Pages: 1 2 3 4 5 6