Qbasicnews.com
define argument types in subs - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html)
+--- Forum: QB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-11.html)
+--- Thread: define argument types in subs (/thread-3186.html)

Pages: 1 2 3 4 5 6


define argument types in subs - oracle - 03-02-2004

TBBQ, your code will work, but you need to DECLARE SUB mysub( foo() AS ANY, i%)


define argument types in subs - TheBigBasicQ - 03-02-2004

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.


define argument types in subs - oracle - 03-03-2004

I didn't say it wouldn't. I just said that you or the compiler would add the line I wrote above Wink