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?
1 Answer
1var list;
function Start () {
list = new Array();
for(var i:int=0;i<5;i++){
list*=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);*
*}*
**