Qbasicnews.com
March 21, 2019, 07:19:53 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: ....... a varble name inside of another........  (Read 1854 times)
zhahaman2001
Member
*
Posts: 32



WWW
« on: December 22, 2004, 06:49:50 PM »

ok i this is how the code is
Code:

for ballnum% = 1 to numberofballs%

         ballx% = INT(RND * 100)
         bally% = INT(RND * 100)

next ballnum%


this is how i wish it could be

Code:

for ballnum% = 1 to numberofballs%

         ballx(ballnum%)% = INT(RND * 100)
         bally(ballnum%)% = INT(RND * 100)

next ballnum%



that way it makes the vables ballx5% or bally316%
you know make it so it put the number right in the varble name

any info would help thanks
Logged

ever wish for anything because if you have a wish in one hand and shit in the other what do you have?
Dj Dennie
Member
*
Posts: 35


WWW
« Reply #1 on: December 22, 2004, 07:14:26 PM »

Why not use an array? Smiley
Logged

: Dj Dennie ::
Sterling Christensen
Na_th_an
*****
Posts: 1328


« Reply #2 on: December 22, 2004, 07:16:09 PM »

Here's how to use an array (in case you don't know):
Code:
dim ballx%(1 to numberofballs%)
dim bally%(1 to numberofballs%)

for ballnum% = 1 to numberofballs%

         ballx%(ballnum%) = INT(RND * 100)
         bally%(ballnum%) = INT(RND * 100)

next ballnum%
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!