Advertise Here

Author Topic: A basic understanding of Arrays  (Read 3400 times)

0 Members and 1 Guest are viewing this topic.

Offline slayer766

  • SMF For Free Full Member
  • *
  • Posts: 212
    • View Profile

  • Total Badges: 13
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
A basic understanding of Arrays
« on: February 04, 2008, 07:31:27 pm »
This tutorial will explain the reason for arrays and how to use them.

Arrays are a very simple way for a coder to keep track of large amounts of coding by setting them up in groups/arrays.


First we start off with this:

Code: [Select]
<script>
//By slayer766

Set[0]=["1","2"]

</script>

The first group named Set[0] will always start with 0 then move its way up by 1 after each new group is set. Now there are two sections in this group seperated by a comma "," You can have as many sets as you'd like in there but I will just show two.


Now we can write the group out for the individual set:


Code: [Select]
<script>
//By slayer766

var Set = new Array();

Set[0]=["1","2"]

document.write(Set[0][0]);
</script>

Using the Set[0] would display 1 and 2 seperated by a comma, making more of a specific choice would be using the other [ 0] and then starting from the left of the set it starts with [ 0] and goes up by 1 each set. So the 1 is in the [ 0] spot and the 2 is in the [1] spot, if you don't understand then just re-read the code and you will get it. So doing Set[0][0] would display whats in the [ 0] spot which is a 1. :D These can change to whatever you want by just changing whats inside the quotations. :)

 

Related Topics

  Subject / Started by Replies Last post
17 Replies
15757 Views
Last post January 13, 2011, 03:52:58 pm
by Hakam J.
0 Replies
5201 Views
Last post February 04, 2008, 07:30:12 pm
by slayer766
0 Replies
766 Views
Last post March 22, 2008, 05:55:24 pm
by dosanjh5
5 Replies
2550 Views
Last post January 29, 2009, 03:31:28 pm
by taogem
4 Replies
2293 Views
Last post June 05, 2014, 07:45:32 am
by SMF For Free