# Getting the position of a certain element in an array

**URL:** <https://forum.kirupa.com/t/getting-the-position-of-a-certain-element-in-an-array/317562>\
**Category:** Uncategorized\
**Created:** [December 24, 2010, 2:56pm UTC](https://forum.kirupa.com/t/getting-the-position-of-a-certain-element-in-an-array/317562 "2010-12-24T14:56:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![OMG](https://avatars.discourse-cdn.com/v4/letter/o/9dc877/32.png) [@OMG](https://forum.kirupa.com/u/OMG)\
**Post date:** [December 24, 2010, 2:56pm UTC](https://forum.kirupa.com/t/getting-the-position-of-a-certain-element-in-an-array/317562/1 "2010-12-24T14:56:58Z")

</div>

Hi

1. let’s say I have an array full of mcs, is there a fast way of knowing the position of mc\_b in that array without looping through it every time?

2. also, is there a fast way of swapping the position of two elements in an array without splitting it and re-sticking the parts?

Thanks
