VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Beginners Guide to Arrays

by L124RD (2 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (4 Votes)

Do you want to store MANY variables in one name? Try Arrays! This Tutorial will Teach you the basics of Creating Arrays! Including MultiDemensional Arrays!

Rate Beginners Guide to Arrays

Beginner's Guide to Arrays




Background


Have you wanted to store 300 integers in a variable? like variable d? well now you can with the Beginner's Guide to Arrays!



Regular Arrays


Arrays are a way of storing data. instead of using 13 variables to hold 13 different integers you can use one to hold all thirteen! using the following code:

dim K(12) as integer

That code holds 13 integers in Variable K. Arrays start at 0 so if you wanted to create 300 integers you'd say 'dim K(299) as integer' instead of dim'ing K1 - K300. 

When Setting Arrays equal to something you use the following Statement:

K(1) = 3

This would create part 2 of K equal to 3. You can put any integer equivilant or equal to the number you put inside of the brakets when you dim'ed K.



Multi-Demensional Arrays


Multi Demensional Arrays are basically the same as Regular Arrays except for one thing. there are more then 1 dimension. Multi-Dimensional Arrays allow you to create Matrixs or even 7d Tables (Don't ask me what those look like). Multi Dimensional Arrays are used for many things. Score Cards and tables are examples of 2 dimensional arrays and 3d Axis' are a examples of 3 Dimensional Arrays. Multi Dimensional Arrays are dim'ed like so:

Dim K(1,1) as integer

That creates 4 K's. You can acess the Variables by:

K(0,1) = K(1,0)

That makes whatever 0,1 on the table is equal to whatever 1,0 is.



Thats it for Arrays. Enjoy your stay at PSC!

L124RD

Download this snippet    Add to My Saved Code

Beginners Guide to Arrays Comments

No comments have been posted about Beginners Guide to Arrays. Why not be the first to post a comment about Beginners Guide to Arrays.

Post your comment

Subject:
Message:
0/1000 characters