array knowledge is cloudy at best

i'm working on making a tutorial, and i want it so when you press the next button, it goes to the "next page" and the back button will go to the "last(previous) page" that, i can do; but how would i call something from an array?

like:

var message : String[];

function Update()
{
 messageValue++;
 messageValue--;
}

how would you do that?

//i use the "for(i = 0; i<Array.Length; i++)"

but i don't know what that does exactly, and i dont know how to use *... could someone explain to me how i would do that with an array?

* *

thanks in advance!

* *

Edit:

* *

the script in the below answer looks okay, but this error comes up:

* *```* *NullReferenceException: Object reference not set to an instance of an object* *Tutorial.GoUpPage () (at Assets/Assets/'Scripts'/Faux Move/GUI/Tutorial.js:22)* *Tutorial.Update () (at Assets/Assets/'Scripts'/Faux Move/GUI/Tutorial.js:13)* *```* *

and it comes up in the

* *```* *function GoUpPage()* *{* *if(currentPage < pages.length)// RIGHT HERE.... but* *{* *currentPage += 1;* *print(pages[currentPage]);* *}* *}* *```* *

and i notice the other reference here:

* *```* *function Update()* *{* *if(Input.GetKeyDown("w"))* *{* *GoUpPage(); // RIGHT HERE* *}* *}* *```*

You might try something like:

 var pages : Array;
    var currentPage : int;

    function Start()
    {
      //pages would be what ever type of data ur pages are...perhaps they are images. in my example they are going to be strings.
      pages = new Array("info on page 1", "info on page 2", "info on page 3");

      //this will print the first page info
       currentPage = 0;
       print(pages[currentPage]);

    }

    function Update()
    {
      ///write some sort of onkeydown stuff here to call your functions
    }
    function GoUpPage()
    {
      if(currentPage < pages.length)
      {
        currentPage += 1;
        print(pages[currentPage]);
      }
    }

    function GoDownPage()
    {
      if(currentPage > 0)
      {
        currentPage -= 1;
        print(pages[currentPage]);
      }
    }
    function PrintAllPages()
   {
      for(i = 0; i < pages.length; i++)
      {
         print(pages*);*
 *}*
 *}*
*```*