

Contributor III
2019-04-17
09:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do... While... Loop...
Helpful tip for others:
While the help documentation indicates that you can set your condition at the beginning of the statement using WHILE, I found that the condition was not being triggered and the loop would go on until I aborted the script. When I moved the condition to the end, it worked as expected.
SET v_loop = 1;
DO
TRACE Loop Number: $(v_loop);
LOOP WHILE $(v_loop) <= 10
577 Views
1 Reply

MVP
2019-04-17
10:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not sure why, but this works
SET v_loop = 1; DO WHILE v_loop <= 10 LET v_loop = $(v_loop) + 1; TRACE Loop Number: $(v_loop); LOOP
but this doesn't
SET v_loop = 1; DO WHILE $(v_loop) <= 10 LET v_loop = $(v_loop) + 1; TRACE Loop Number: $(v_loop); LOOP
