[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

about while loop and case

Posted on 1998-10-28
9
Medium Priority
?
364 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?
0
Comment
Question by:lewis_loo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1215884
hi lewis_loo

Why this

that are two different things

meikl
0
 
LVL 2

Expert Comment

by:omsec
ID: 1215885
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
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1215886
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
0
Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

 
LVL 7

Expert Comment

by:Inteqam
ID: 1215887
To lewis_loo:

Can you explain more?


0
 
LVL 2

Expert Comment

by:omsec
ID: 1215888
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

0
 
LVL 1

Expert Comment

by:saam
ID: 1215889
strange question... more info please
0
 
LVL 1

Expert Comment

by:FuzzyLogic
ID: 1215890
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...
0
 
LVL 3

Expert Comment

by:vikiing
ID: 1215891
The question is not clear enough, Lewis. Give an example of what you need, or specify a bit more.
0
 
LVL 3

Accepted Solution

by:
daitt earned 0 total points
ID: 1215892
I guess you want to change a case statement's constants (and maybe the switch) within a while statement. There's only one way to do this (as far as I know), and it's not easy at all. You have to have Assmbler knowledges, compiler knowledges to do this.
Just decode your program (using Debug or Sourcer is up to you), then look at the code generated by the compiler. You'll see the positions of the constant, the code to compare the switch to the constants and ranges... everything there. Write down the offset of these things. Then you can return to your Pascal program, append the modifying code after the case statement (to write the value needed into memory at constants's position).
These things above is just for understanding Pascal compiler and enhance you knowlegde of Machine Language. If you have no experience in these, don't touch your exe file. A good way is to use IF statement instead of CASE statement. IF statement can be change anytime you want.
Anyway, it's too much for your two points.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With so many activities to perform, Exchange administrators are always busy in organizations. If everything, including Exchange Servers, Outlook clients, and Office 365 accounts work without any issues, they can sit and relax. But unfortunately, it…
Tech spooks aren't just for those who are tech savvy, it also happens to those of us running a business. Check out the top tech spooks for business owners.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question