?
Solved

about while loop and case

Posted on 1998-10-28
9
Medium Priority
?
358 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
New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

 
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

We are witnesses that everyone is saying that our children shouldn't "play" with a technology because it is dangerous. This article is going to prove that they are wrong.
The top devops trends for 2017 are focused on improved deployment frequency, decreased lead time for change and decreased MTTR.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month11 days, 7 hours left to enroll

752 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