🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.lang.basic
Article #623

Re: [QBasic] Return a Array from a Function

#623
From: Tom Lake
Date: Sat, 18 Nov 2000 00:00
20 lines
1654 bytes
> I have a function and i want the function to return an array...

Can't do it.  Try using a SUB with the array as one of the parameters.

DIM a(1 TO 20)
FOR i = 1 to 20
    a(i) = i
NEXT i
MultBy2 a()
FOR i = 1 TO 20
    PRINT a(i);
NEXT i
END
SUB MultBy2(b())
    FOR i = 1 TO UBOUND(b)
        b(i) = b(i) * 2
    NEXT i
END SUB

Tom Lake
Technical Details
Message-ID: <qLDR5.238194$JS3.35756412@typhoon.nyroc.rr.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3a16b7ae$0$5188@SSP1NO25.highway.telekom.at>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109a70,f959de4259a83187
X-Google-Attributes: gid109a70,public
X-Google-Thread: f645d,f959de4259a83187
X-Google-Attributes: gidf645d,public
X-Google-Thread: f7aba,f959de4259a83187
X-Google-Attributes: gidf7aba,public
X-Google-Thread: 1164ba,f959de4259a83187
X-Google-Attributes: gid1164ba,public
X-Google-Thread: 10feaf,f959de4259a83187
X-Google-Attributes: gid10feaf,public
X-Google-Thread: 112458,f959de4259a83187
X-Google-Attributes: gid112458,public
X-Google-Thread: 10ab99,f959de4259a83187
X-Google-Attributes: gid10ab99,public
From: "Tom Lake" <tlake@twcny.rr.com>
Subject: Re: [QBasic] Return a Array from a Function
Date: 2000/11/18
Message-ID: <qLDR5.238194$JS3.35756412@typhoon.nyroc.rr.com>
X-Deja-AN: 695228224
References: <3a16b7ae$0$5188@SSP1NO25.highway.telekom.at>
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
X-Complaints-To: abuse@twcny.rr.com
X-Trace: typhoon.nyroc.rr.com 974587990 24.24.25.81 (Sat, 18 Nov 2000 17:53:10 EST)
Organization: Time Warner Road Runner - Syracuse NY
NNTP-Posting-Date: Sat, 18 Nov 2000 17:53:10 EST
Newsgroups: alt.lang.basic,comp.lang.basic,comp.lang.basic.visual,fido.ger.basic,microsoft.public.basic,relcom.comp.lang.basic,z-netz.sprachen.basic