Qbasicnews.com
April 09, 2020, 06:29:41 AM *
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: DIM SHARED 'n such  (Read 1851 times)
NovaProgramming
Been there, done that
*****
Posts: 1025



« on: March 12, 2003, 02:58:07 PM »

Hey guys I don't consider myself a newbie but this is really a newbie question with a newbie answer so I thought I probably shouldn't take up space in the programming help for it.

if you use command

DIM SHARED <variable> AS <type>

then it can be acessed from anywhere in the program, SUB or otherwise, right?  I don't need to declare it....

SUB Town1 (gold, playername$ ... )

right?  Just checking,

-Nova
Logged

ovaProgramming.

One night I had a dream where I was breaking balls.  The next morning, BALLSBREAKER was born.

Quote from: "Haye, Phillip J."
 Excellent.  Now you can have things without paying for them.

BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it Sad.
-----------------------------
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #1 on: March 12, 2003, 03:07:54 PM »

yessir. And you can even dim an array with one dimension until you figure out how many dimensions you need, and then you can REDIM it INSIDE the SUB!!
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
NovaProgramming
Been there, done that
*****
Posts: 1025



« Reply #2 on: March 12, 2003, 08:09:08 PM »

Shocked ty Shocked
Logged

ovaProgramming.

One night I had a dream where I was breaking balls.  The next morning, BALLSBREAKER was born.

Quote from: "Haye, Phillip J."
 Excellent.  Now you can have things without paying for them.

BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it Sad.
-----------------------------
Glenn
I hold this place together
*****
Posts: 786



WWW
« Reply #3 on: March 12, 2003, 10:15:03 PM »

array later?  That doesn't work for me (in spite of the fact that by logic, it should, as long as it was a dynamic array in the first place).  I always have to use REDIM in the first place if I'm going to use REDIM later.


Quote from: "Agamemnus"
yessir. And you can even dim an array with one dimension until you figure out how many dimensions you need, and then you can REDIM it INSIDE the SUB!!
Logged

ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #4 on: March 13, 2003, 12:53:12 AM »

yeah.
But I have $DYNAMIC and /ah.
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Glenn
I hold this place together
*****
Posts: 786



WWW
« Reply #5 on: March 13, 2003, 01:11:45 AM »

(but the /AH really shouldn't matter) and I still can't do it.  (But now I have to go try again.)


Well, I'm glad I tried again (and that we had this discussion).  Now it works.  I'm now wondering if I had actually made the array dynamic before using '$DYNAMIC or if I had made it dynamic by using a variable to specify the size.
Logged

ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
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!