# Help making algorythm

**URL:** https://forum.kirupa.com/t/help-making-algorythm/266909
**Category:** flash
**Created:** [July 25, 2008, 1:14pm UTC](https://forum.kirupa.com/t/help-making-algorythm/266909 "2008-07-25T13:14:50Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![RummeR](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rummer/32/1825_2.png) [@RummeR](https://forum.kirupa.com/u/RummeR)
#### Post date: [July 25, 2008, 1:14pm UTC](https://forum.kirupa.com/t/help-making-algorythm/266909/1 "2008-07-25T13:14:50Z")

</div>

My problem may not be so connected with AS2 but the thing is that I am programing with AS2 so here goes my question:

I want to create an algorithm that looks up an array and finds the nearest integer in it. Lets say i have different numbers like 1, 2, 4, 5, 8, 9 and i want to find the nearest member to 6 from those numbers. How should i build the algorithm. So far i’m using two arrays and two inside loops, but cant find the right way to make it. 😕 So im am hoping for you kirupians to help me in any way. Thank you. :block:
