- Home /
 
               Question by 
               Jason Hamilton · Mar 16, 2011 at 07:33 AM · 
                javascriptguiarrayint  
              
 
              Arrange ints from biggest to smallest and display them in a table
Hey, Id like to arrange 5 ints from biggest to smallest, then I would like to add another and have it either placed somewhere on the list and if its too small not have it show up, how is this done?
               Comment
              
 
               
              Answer by ina · Mar 16, 2011 at 08:07 AM
var list;
function Start () { list = new Array(); for(var i:int=0;i<5;i++){ list[i]=Random.Range(0,10); }
 sortAndDisplay();
 addAnother(3,5);
 addAnother(5,1);
 sortAndDisplay();
}
function sortAndDisplay(){ Debug.Log("Unsorted "+list); list.Sort(); Debug.Log("Sorted "+ list); } function addAnother(n:int,min:int){ if(n>min)list.Push(n); }
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                