We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

about while loop and case

lewis_loo
lewis_loo asked
on
Medium Priority
391 Views
Last Modified: 2010-04-16
How can I change the case statement in the while loop looping?
can you show me the source code for this question?
Comment
Watch Question

Top Expert 2004

Commented:
hi lewis_loo

Why this

that are two different things

meikl

Commented:
think you mean :

while Something <> True then
  begin
    case ThisVar of
      ...
  end
else // "Something" is now True
  begin
    case ThatVar of
      ...
  end;

not sure if you mean that
Top Expert 2004

Commented:
hi omsec

something is wrong in your example. Where come the else. In while ..do there can no else in the case there can be a else but then something <> true.

meikl

Commented:
To lewis_loo:

Can you explain more?


Commented:
i see, i didnt check the Syntax. I also never used While and Else
together, i thought WHILE "something" is true do the case block,
Else (after) do the other, the else-bleck

while Something <> True then
  begin
    case ThisVar of
      ...
    end; { of case}
  end
else // "Something" is now True
  begin
    case ThatVar of
      ...
    end; {of case}
  end;

.but never done it this way

Commented:
strange question... more info please
If you mean that the case switches are changed every time (for example according to some input string), while the while loop continue, this is not possible. You should use a bunch of "if" statements.
Anyway, too long thread for a two points question...

Commented:
The question is not clear enough, Lewis. Give an example of what you need, or specify a bit more.
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.