🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.lang.basic
Article #596

Re: Simple basic query (I think)

#596
From: Tom Lake
Date: Fri, 13 Apr 2001 13:21
33 lines
2223 bytes
> help wanted I am learning qbasic
> I am trying to create variables dependent on a input.
> For example If I input G=3
> I would like to create variables
> q1
> q2 &
> q3
> If I input G=5
> I would like to create variables
> q1
> q2
> q3
> q4 &
> q5

You have to use an array:

INPUT "Enter the number of variables to be created: ", G
DIM q(1 TO G)

then to refer to a particular variable (let's use 3 for an example) do this:

PRINT q(3)

or A = q(3) + 5

To print a list of all the variables, do this:

FOR i = 1 TO G
    PRINT q(i)
NEXT

Tom Lake
Technical Details
Message-ID: <y3DB6.10890$jh.2075360@typhoon.nyroc.rr.com>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!netnews.com!xfer02.netnews.com!newsfeed.skycache.com!Cidera!cyclone-0.nyroc.rr.com!cyclone-out.nyroc.rr.com!typhoon.nyroc.rr.com.POSTED!not-for-mail
References: <gRCB6.2220$482.11498@newsfeeds.bigpond.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f8e35,5fb774e21a4b13af
X-Google-Attributes: gidf8e35,public
X-Google-Thread: 10c949,5fb774e21a4b13af
X-Google-Attributes: gid10c949,public
X-Google-Thread: 10ab99,5fb774e21a4b13af
X-Google-Attributes: gid10ab99,public
X-Google-Thread: f7646,5fb774e21a4b13af
X-Google-Attributes: gidf7646,public
X-Google-Thread: 108062,5fb774e21a4b13af
X-Google-Attributes: gid108062,public
X-Google-Thread: f5300,5fb774e21a4b13af
X-Google-Attributes: gidf5300,public
X-Google-Thread: 112d3b,5fb774e21a4b13af
X-Google-Attributes: gid112d3b,public
X-Google-ArrivalTime: 2001-04-13 06:24:13 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!netnews.com!xfer02.netnews.com!newsfeed.skycache.com!Cidera!cyclone-0.nyroc.rr.com!cyclone-out.nyroc.rr.com!typhoon.nyroc.rr.com.POSTED!not-for-mail
From: "Tom Lake" <tlake@twcny.rr.com>
Newsgroups: alt.lang.basic,alt.lang.gfa-basic,comp.lang.basic.misc,cz.comp.lang.basic.visual,fj.lang.basic,fr.comp.lang.basic,francom.prog.basic
References: <gRCB6.2220$482.11498@newsfeeds.bigpond.com>
Subject: Re: Simple basic query (I think)
Lines: 35
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Message-ID: <y3DB6.10890$jh.2075360@typhoon.nyroc.rr.com>
Date: Fri, 13 Apr 2001 13:21:34 GMT
NNTP-Posting-Host: 66.24.12.110
X-Complaints-To: abuse@twcny.rr.com
X-Trace: typhoon.nyroc.rr.com 987168094 66.24.12.110 (Fri, 13 Apr 2001 09:21:34 EDT)
NNTP-Posting-Date: Fri, 13 Apr 2001 09:21:34 EDT
Organization: Time Warner Road Runner - Syracuse NY