# What would this line of code be in AS?

**URL:** <https://forum.kirupa.com/t/what-would-this-line-of-code-be-in-as/320128>\
**Category:** flash\
**Created:** [March 15, 2011, 1:24am UTC](https://forum.kirupa.com/t/what-would-this-line-of-code-be-in-as/320128 "2011-03-15T01:24:39Z")\
**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:** [March 15, 2011, 1:24am UTC](https://forum.kirupa.com/t/what-would-this-line-of-code-be-in-as/320128/1 "2011-03-15T01:24:39Z")

</div>

> **[Cycle sort](https://en.wikipedia.org/wiki/Cycle_sort)**
>
> Cycle sort is an in-place, unstable sorting algorithm, a comparison sort that is theoretically optimal in terms of the total number of writes to the original array, unlike any other in-place sorting algorithm. It is based on the idea that the permutation to be sorted can be factored into cycles, which can individually be rotated to give a sorted result. Unlike nearly every other sort, items are never written elsewhere in the array simply to push them out of the way of the action. Each value is ei...

  
in the algorithm section:

```php
 while item == array[pos]:
      pos += 1
    array[pos], item = item, array[pos]
    writes += 1

```

**array[pos], item = item, array[pos]**

thanks
