playMaker

Author Topic: Get Largest/Smallest int from array  (Read 3999 times)

bkups2003

  • Playmaker Newbie
  • *
  • Posts: 49
Get Largest/Smallest int from array
« on: October 06, 2013, 11:06:48 PM »
Hello.

I have 4 Variables of different values and i need to find the largest of them. Is there an action available to do this instead of making a web of compares? Adding them to an array and finding the index of the largest one sounds like a good way i can know which variable is the largest and what to do with that variable. Is there a way to do this at the moment?

Thanks alot.

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Get Largest/Smallest int from array
« Reply #1 on: October 06, 2013, 11:52:30 PM »
Array sort will arrange the array from lowest to highest - then get 0 and whatever the array count is (-1)


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Get Largest/Smallest int from array
« Reply #3 on: October 07, 2013, 03:11:12 AM »
Hi,

 and there is ArrayListReverse to reverse the sorting you just did

bye,

 Jean