SMF For Free Support Forum
Signup For Free Forum
October 15, 2008, 05:37:04 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to SMF For Free. The best free SMF Host
 
   Home   Help Search Arcade Gallery Login Register  

Pages: [1]
  Print  
Author Topic: A basic understanding of Arrays  (Read 376 times)
0 Members and 1 Guest are viewing this topic.
slayer766
SMF For Free Member
*
Offline Offline

Posts: 36



View Profile WWW
« 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:
<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:
<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. Cheesy These can change to whatever you want by just changing whats inside the quotations. Smiley
Logged

Check our Code Index which currently contains 453 codes!



Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.6 | SMF © 2006-2008, Simple Machines LLC
ServerBeach Coupon
Page created in 0.159 seconds with 18 queries.