Trying to get an array to show up in Debug.log

I’m trying to script a high score table that could be saved in PlayerPrefsX for my game project, but I can’t seem to get the int array that I created for it to even show up in Debug.Log (or anywhere else really) even after creating a test value to see if anything is even being entered. Not even the Inspector shows any indication that anything happened, all of the values show up as 0. Here’s the chunk of code I have for it so far:

var scoreArray = new int[8];
var testScore:int = 1000;
var i:int;
var j:int;

function Start () {

}

function Update () {
	
	for (i = 0; i > 8; i++) //high score check
		{
			if (testScore > scoreArray*)*
  •  	{						*
    
  •  		for (j = scoreArray.length - 1; j <= i; --j ) //pushes the score values down starting from the slot that testScore ends up*
    
  •  		{*
    
  •  	       scoreArray[j] = scoreArray[j-1];*
    
  •  	    }*
    

_ scoreArray = testScore;_
* }*

_ Debug.Log(scoreArray*);
}*_

}
I prefer solutions in JS as that is the language that I have the most experience with.

There are few loop holes .

  1. Break the loop as soon as you get any index which has lesser value then high-score (Coming from top to bottom). Why traverse bottom numbers they are definitely smaller as compared to high-score and not your concern.

  2. While breaking loop sort array based on new high-score .Also your re-arranging array logic is not correct .
    try this :

    for (j = scoreArray.length - 1 ; j > i ; j-- )
    scoreArray [j] = scoreArray [j - 1];

Cheers
Arun

I think there is some problem with your code you posted. The for loop on line 12 should be

for (i = 0; i < 8; i++) //high score check

rather than

 for (i = 0; i > 8; i++) //high score check

The “>” should be replaced with “<”