On the Cincinnati controls at work, this is done with G10 and G11 codes. Actually the if/then (we call it a check block) is done with only the G11. The G10 is an assignment block.
Would go something like this:
N01G10=[T1]V0
N02Q100
N03G10=[T1]v[T1]+1
SECTION OF PROGRAM
YOU WANT TO REPEAT
HERE
N8G11E[T1]<=10L-100
N9M00
N01 Sets a 'temporary register' to a value of 0.
N02 is to give the 'check block' the position to jump back to if the statement on N8 equals 'true'.
N03 sets a 'temporary register' to the value +1 every time it loops back, thus acting like a counter.
N08 checks to see if [T1] is less than or equal to 10. If it IS less than or equal to 10, it skips back to Q100 and reruns. If it is NOT equal to or less than 10, it continues with the next line.
The temporary registers ('t-registers' in the shop) are one of the most useful things I've found on the cincinnati controls. With those and the G11, you can do alot of things. Use it as a counter for just a simple spring pass. Sure it would probably be less confusing just to add an extra pass. But when you are doing the profile of a part that's roughly 100" x 40", this is a bit quicker.
You can also change ANY value in any of the tables. Tool offsets, position offsets, D and H codes, etc. Especially helpful when using the probe to calculate offsets and such.
This is all done on the shop floor. Programming has no way of putting this in the programs themselves. But then again, why would they need to? Their programs are perfect, right?
I realise this has nothing to do with the Fanuc control, but someone out there might find it useful. I'd love to see something like this implemented into some of the control software for us home guys. Or does someone already use it? Mach 2 maybe?