# \[MX\] Loops! To Restart And To Break Them!

**URL:** <https://forum.kirupa.com/t/mx-loops-to-restart-and-to-break-them/92152>\
**Category:** Uncategorized\
**Created:** [October 13, 2003, 11:26pm UTC](https://forum.kirupa.com/t/mx-loops-to-restart-and-to-break-them/92152 "2003-10-13T23:26:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lrhb](https://avatars.discourse-cdn.com/v4/letter/l/e47774/32.png) [@lrhb](https://forum.kirupa.com/u/lrhb)\
**Post date:** [October 13, 2003, 11:26pm UTC](https://forum.kirupa.com/t/mx-loops-to-restart-and-to-break-them/92152/1 "2003-10-13T23:26:26Z")

</div>

Hello!

I’m working on a small validation script, to check elements of a data object for duplicates… it goes a little something like this (hit it!):

[AS]for (i=0;i\<\_root.wddxData.getRowCount();++i){  
city = \_root.wddxData.ADDRESSCITY\*;  
if (previousCity == city){  
trace(city+" IS A DUPLICATE"); }

[…]

previousCity = city;  
}[/AS]

It works well enough, and goes through the recordset and tells me when there’s duplicates… but what I tried didn’t work. i thought if I did:

[AS] if (previousCity == city){  
i = ++i; }[/AS]

and continued my loop, it would work, but instead, it would catch the first duplicate, but miss the rest after that.

Basically what I’d like to do is simple: If this record\* is equal to record[i+1], skip record[i+1] and go through it again… I just can’t seem to figure it out :hat:

Advice, as always, appreciated!

ever curious,  
lrhb
