Sven Schulzke wrote: > Is there a way to set the increment of a repeat loop? > > The aim is to search every 3rd line of a field for a number. I thought > of something like: > > put fld "schedule" into fldVar > repeat with i = 1 to the number of lines of fldvar >step 3 ?< > repeat with j = 1 to the number of words of line i of fldVar > if word j of line i of fldvar is a number then put word j of > line i of fldvar after hoursVar(i) > end repeat > end repeat For a generalized approach, try something like: put fld "schedule" into fldVar put 1 into lineNum -- or the first line you want to look at repeat while lineNum <= the number of lines of fldVar -- search the line and process it add 3 to lineNum -- or any other increment end repeat Its probably not a good idea to manually adjust the loop variable in a for-loop. That technique is not portable to other programming languages, and even when it works, it's what they call a "bad habit" :-) Best solution would be a construct like: for <loop_var> = <startValue> to <endValue> <messages> step repeat <increment> or perhaps: for <loop_var> = <startValue> to <endValue> with step <increment> <messages> end repeat -- Steven D'Aprano ========================================== M.B. Sales Pty Ltd Ph: +61 3 9460-5244 A.C.N. 005-964-796 Fax: +61 3 9462-1161
