12.07.2015 Views

RAPID reference manual - Technology

RAPID reference manual - Technology

RAPID reference manual - Technology

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

FORRobotWare-OSInstructionExampleFOR i FROM 10 TO 2 STEP -1 DOa{i} := a{i-1};ENDFORThe values in an array are adjusted upwards so that a{10}:=a{9}, a{9}:=a{8} etc.Program execution1. The expressions for the start, end, and step values are evaluated.2. The loop counter is assigned the start value.3. The value of the loop counter is checked to see whether its value lies between thestart and end value, or whether it is equal to the start or end value. If the value of theloop counter is outside of this range, the FOR loop stops and program execution continueswith the instruction following ENDFOR.4. The instructions in the FOR loop are executed.5. The loop counter is incremented (or decremented) in accordance with the step value.6. The FOR loop is repeated, starting from point 3.LimitationsThe loop counter (of data type num) can only be accessed from within the FOR loopand consequently hides other data and routines that have the same name. It can only beread (not updated) by the instructions in the FOR loop.Decimal values for start, end or stop values, in combination with exact termination conditionsfor the FOR loop, cannot be used (undefined whether or not the last loop is running).RemarksIf the number of repetitions is to be repeated as long as a given expression is evaluatedto a TRUE value, the WHILE instructions should be used instead.116 <strong>RAPID</strong> <strong>reference</strong> <strong>manual</strong> - part 1a, Instructions A-R

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!