Skipping Commands in a DO Loop using Skip or Skip if
- Last UpdatedFeb 08, 2023
- 1 minute read
A skip command is used to go back to the beginning of the do loop, to repeat the loop with the next value of the do loop counter, omitting any commands following the skip command. The following example skips odd numbers:
do !X
!Number = !Sample[!X]
if ((INT(!Number/2) NE (!Number/2)) then
skip
endif
!Result = !Result + !Number
enddo
The skip if command can sometimes be more convenient:
do !X
!Number = !Sample[!X]
skip if (INT(!Number/2) NE (!Number/2))
!Result = !Result + !Number
enddo