What is the correct order of evaluation of condition phrases.

Time Sharing Option, Interactive System Productivity Facility and REstructured eXtended eXecutor

Moderator: mickeydusaor

Post Reply
RaGa
New Member
Posts: 7
Joined: Wed Sep 09, 2015 9:52 am

What is the correct order of evaluation of condition phrases.

Post by RaGa »

Hi

I read this in the TSO/E Rexx manual:
3.4.3 Conditional phrases (WHILE and UNTIL)
.
.
For a WHILE loop, the condition is evaluated at the top of the group of instructions. For an UNTIL loop, the condition is evaluated at the bottom--before the control variable has been stepped.
I am not very clear on the WHILE. It describes the an UNTIL phrase well but not for the WHILE phrase. The WHILE condition is evaluated before or after the control variable has been stepped? Can you please guide me?
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: What is the correct order of evaluation of condition phrases.

Post by enrico-sorichetti »

while the while logic is clear

the until logic is a bit weirder
the loop is executed at least once

see

Code: Select all

i = 4
do  until  i > 3
    say "inside" i
    i = i + 1
end
say "at end" i

i = 1
do  until  i > 3
    say "inside" i
    i = i + 1
end
say "at end" i
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
RaGa
New Member
Posts: 7
Joined: Wed Sep 09, 2015 9:52 am

Re: What is the correct order of evaluation of condition phrases.

Post by RaGa »

I thought it other way. Thanks for the example. I'll need to experimnet more to uderstand it.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “TSO, ISPF & REXX (Do you still do CLIST?!).”