Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Global Arrays

Author
Message
Social Disease
20
Years of Service
User Offline
Joined: 30th Sep 2003
Location: State of Confusion, beyond Denial...
Posted: 9th Jun 2004 03:31
Alright, Arrays are supposed to be global right?
So why is that I have declared an array
Quote: "Dim Mon$(10)"

Then I assign it a value
Quote: "Mon$(3) = "Garfield""

And then, in my function I do
Quote: "Print Monster$(3)"

And nothing shows up?
I'm dim-ing the array in my main program, above my loop, and I'm using DBPro.

comments?


Think Gad fro Spill Chock!
Tyler
20
Years of Service
User Offline
Joined: 10th Jan 2004
Location:
Posted: 9th Jun 2004 03:34
someone correct me if im wrong, but aren't arrays only numbers??+

http://www.geocities.com/tylerc1324
Social Disease
20
Years of Service
User Offline
Joined: 30th Sep 2003
Location: State of Confusion, beyond Denial...
Posted: 9th Jun 2004 03:41 Edited at: 9th Jun 2004 03:42
I am SUCH a moron.
For the record yes, arrays are global.
Yes you can use strings as arrays.
And in order for your varible to print within a function, you need to put the statement above EndFunction.

that is all.


Think Gad fro Spill Chock!
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 9th Jun 2004 04:22
you can array anything, including UDT's
Mon$(3) and Monster$(3) are not the same array
Arrays are global
Affect your arrays within your functions, but don't try and pass/return em


* DBP_NETLIB_v1.2 - NOW WITH VARIABLE WATCHER! * Click Logo
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 9th Jun 2004 11:04
Let's look at the array name you're using.

Mon$(3) = "Garfield"
Print Monster$(3)

Need I say more?

"eureka" - Archimedes

Login to post a reply

Server time is: 2024-09-22 12:39:40
Your offset time is: 2024-09-22 12:39:40